Mercurial > hg
annotate tests/test-tag @ 11063:eb23c876c111
tag: warn users about tag/branch possible name conflicts
As reported recently, Mercurial users can easily find confusion when
using a common name for a tag and a branch. It seems reasonable to warn
them about this potential outcome, to avoid that "surprise".
* Explain briefly the issue in "hg help tag"
* Warn when tagging a revision
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 19 Apr 2010 17:41:12 +0900 |
parents | 39cf453da958 |
children | 6d7cf82453be |
rev | line source |
---|---|
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 |