tests/test-tag
author Benjamin Pollack <benjamin@bitquabit.com>
Tue, 27 Jul 2010 14:40:25 -0400
branchstable
changeset 11692 52e4ac3e63f7
parent 11185 6d7cf82453be
permissions -rwxr-xr-x
tag: do not allow tag names to consist solely of whitespace (issue2307) (simplification and test by mpm)
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
8417
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
     3
hg init test
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
     4
cd test
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
     5
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     6
echo a > a
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     7
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
     8
hg commit -m "test" -d "1000000 0"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
     9
hg history
11692
52e4ac3e63f7 tag: do not allow tag names to consist solely of whitespace (issue2307)
Benjamin Pollack <benjamin@bitquabit.com>
parents: 11185
diff changeset
    10
52e4ac3e63f7 tag: do not allow tag names to consist solely of whitespace (issue2307)
Benjamin Pollack <benjamin@bitquabit.com>
parents: 11185
diff changeset
    11
hg tag ' '
52e4ac3e63f7 tag: do not allow tag names to consist solely of whitespace (issue2307)
Benjamin Pollack <benjamin@bitquabit.com>
parents: 11185
diff changeset
    12
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
    13
hg tag -d "1000000 0" "bleah"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    14
hg history
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    15
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    16
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
    17
hg tag -d "1000000 0" "bleah2" || echo "failed"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    18
1596
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    19
hg revert .hgtags
6321
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" -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
    21
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
    22
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
    23
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
    24
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" --remove "blecch" || echo "failed"
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" --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
    27
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
    28
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
    29
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
    30
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
    31
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
    32
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
    33
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    34
cat .hgtags
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    35
cat .hg/localtags
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    36
2647
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    37
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
    38
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
    39
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
    40
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
    41
1561
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    42
hg tag -l 'xx
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    43
newline'
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    44
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
    45
8417
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    46
echo % cloning local tags
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    47
cd ..
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    48
hg -R test log -r0:5
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    49
hg clone -q -rbleah1 test test1
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    50
hg -R test1 parents --style=compact
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    51
hg clone -q -r5 test#bleah1 test2
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    52
hg -R test2 parents --style=compact
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    53
hg clone -q -U test#bleah1 test3
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    54
hg -R test3 parents --style=compact
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    55
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    56
cd test
4892
d69b1fb111b9 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
Bryan O'Sullivan <bos@serpentine.com>
parents: 2647
diff changeset
    57
echo % issue 601
4933
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    58
python << EOF
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    59
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
    60
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
    61
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
    62
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
    63
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
    64
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
    65
4933
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    66
python << EOF
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    67
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
    68
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
    69
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
    70
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
    71
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
    72
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
    73
cat .hgtags
11063
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    74
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    75
echo % tag and branch using same name
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    76
hg branch tag-and-branch-same-name
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    77
hg ci -m"discouraged"
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    78
hg tag tag-and-branch-same-name
11185
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    79
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    80
echo '% test custom commit messages'
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    81
cat > $HGTMP/editor <<'__EOF__'
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    82
#!/bin/sh
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    83
echo "custom tag message" > "$1"
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    84
echo "second line" >> "$1"
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    85
__EOF__
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    86
chmod +x "$HGTMP"/editor
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    87
HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    88
hg log -l1 --template "{desc}\n"