tests/test-tag
author John Coomes <john.coomes@sun.com>
Fri, 14 Mar 2008 15:38:56 -0700
changeset 6321 55ba3bc5b8fd
parent 4933 5fb8f5992a3d
child 8417 39cf453da958
permissions -rwxr-xr-x
tag: allow multiple tags to be added or removed - Example: "hg tag -r 42 build-25 beta-1" will add tags build-25 and beta-1 for rev 42. - The deprecated and undocumented usage "hg tag arg1 arg2" used to emit a warning, then add tag arg1 for rev arg2 (equivalent to "hg tag -r arg2 arg1"). It will now add tags arg1 and arg2 for the current revision. - If one tag triggers an error, no tags are added/removed (all or nothing).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
800
ec85f9e6f3b1 Don't use 'set -x', fix exports, sed and hexdump usage for Solaris.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 749
diff changeset
     1
#!/bin/sh
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     2
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     3
hg init
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     4
echo a > a
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     5
hg add a
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1654
diff changeset
     6
hg commit -m "test" -d "1000000 0"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     7
hg history
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1654
diff changeset
     8
hg tag -d "1000000 0" "bleah"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     9
hg history
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    10
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    11
echo foo >> .hgtags
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1654
diff changeset
    12
hg tag -d "1000000 0" "bleah2" || echo "failed"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    13
1596
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    14
hg revert .hgtags
6321
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    15
hg tag -d "1000000 0" -r 0 x y z y y z || echo "failed"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    16
hg tag -d "1000000 0" tap nada dot tip null . || echo "failed"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    17
hg tag -d "1000000 0" "bleah" || echo "failed"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    18
hg tag -d "1000000 0" "blecch" "bleah" || echo "failed"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    19
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    20
hg tag -d "1000000 0" --remove "blecch" || echo "failed"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    21
hg tag -d "1000000 0" --remove "bleah" "blecch" "blough" || echo "failed"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    22
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1654
diff changeset
    23
hg tag -d "1000000 0" -r 0 "bleah0"
6321
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    24
hg tag -l -d "1000000 0" -r 1 "bleah1"
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    25
hg tag -d "1000000 0" gack gawk gorp
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    26
hg tag -d "1000000 0" -f gack
55ba3bc5b8fd tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents: 4933
diff changeset
    27
hg tag -d "1000000 0" --remove gack gorp
1596
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    28
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    29
cat .hgtags
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    30
cat .hg/localtags
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    31
2647
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    32
hg update 0
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    33
hg tag -d "1000000 0" "foobar"
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    34
cat .hgtags
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    35
cat .hg/localtags
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    36
1561
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    37
hg tag -l 'xx
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    38
newline'
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    39
hg tag -l 'xx:xx'
4892
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    40
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    41
echo % issue 601
4933
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    42
python << EOF
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    43
f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close()
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    44
f = file('.hg/localtags', 'w'); f.write(last); f.close()
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    45
EOF
4892
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    46
cat .hg/localtags
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    47
hg tag -l localnewline
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    48
cat .hg/localtags
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    49
4933
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    50
python << EOF
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    51
f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close()
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    52
f = file('.hgtags', 'w'); f.write(last); f.close()
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    53
EOF
4892
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    54
hg ci -d '1000000 0' -m'broken manual edit of .hgtags'
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    55
cat .hgtags
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    56
hg tag -d '1000000 0' newline
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    57
cat .hgtags