tests/test-tag
author Yuya Nishihara <yuya@tcha.org>
Fri, 21 May 2010 20:55:18 +0900
changeset 11208 2313dc4d9817
parent 11185 6d7cf82453be
child 11692 52e4ac3e63f7
permissions -rwxr-xr-x
tests: fix bashism to load helpers.sh `source` isn't available at POSIX sh.
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
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
    10
hg tag -d "1000000 0" "bleah"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    11
hg history
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    12
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    13
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
    14
hg tag -d "1000000 0" "bleah2" || echo "failed"
401
af4848f83e68 From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
diff changeset
    15
1596
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    16
hg revert .hgtags
6321
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" -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
    18
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
    19
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
    20
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
    21
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" --remove "blecch" || 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" --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
    24
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
    25
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
    26
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
    27
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
    28
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
    29
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
    30
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    31
cat .hgtags
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    32
cat .hg/localtags
41366b7d6709 fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1561
diff changeset
    33
2647
46182568b4ce change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
    34
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
    35
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
    36
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
    37
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
    38
1561
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    39
hg tag -l 'xx
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    40
newline'
9c6d0abdb94e disallow '\n' and '\r' in tag names
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1308
diff changeset
    41
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
    42
8417
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    43
echo % cloning local tags
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    44
cd ..
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    45
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
    46
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
    47
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
    48
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
    49
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
    50
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
    51
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
    52
39cf453da958 clone: try updating to the actual changeset specified in options
Brett Carter <brett@rdnzl.net>
parents: 6321
diff changeset
    53
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
    54
echo % issue 601
4933
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    55
python << EOF
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    56
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
    57
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
    58
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
    59
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
    60
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
    61
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
    62
4933
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    63
python << EOF
5fb8f5992a3d fix test-tag on Solaris
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4892
diff changeset
    64
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
    65
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
    66
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
    67
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
    68
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
    69
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
    70
cat .hgtags
11063
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    71
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    72
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
    73
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
    74
hg ci -m"discouraged"
eb23c876c111 tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8417
diff changeset
    75
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
    76
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    77
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
    78
cat > $HGTMP/editor <<'__EOF__'
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    79
#!/bin/sh
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    80
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
    81
echo "second line" >> "$1"
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    82
__EOF__
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    83
chmod +x "$HGTMP"/editor
6d7cf82453be tag: add -e/--edit option for modifying the commit message
Steve Losh <steve@stevelosh.com>
parents: 11063
diff changeset
    84
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
    85
hg log -l1 --template "{desc}\n"