Mercurial > hg
annotate tests/test-tags @ 9442:080227f584a1
zeroconf: fix hgweb published URLs (issue1819)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 13 Sep 2009 17:23:47 +0200 |
parents | ae3089cefaab |
children | a604c98dbf62 |
rev | line source |
---|---|
544
3d4d5f2aba9a
Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
345
diff
changeset
|
1 #!/bin/sh |
345 | 2 |
3 mkdir t | |
4 cd t | |
5 hg init | |
6 hg id | |
7 echo a > a | |
8 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:
925
diff
changeset
|
9 hg commit -m "test" -d "1000000 0" |
345 | 10 hg co |
11 hg identify | |
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2320
diff
changeset
|
12 T=`hg tip --debug | head -n 1 | cut -d : -f 3` |
4143
26314500a5e1
Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3577
diff
changeset
|
13 hg tag -l "This is a local tag with a really long name!" |
26314500a5e1
Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3577
diff
changeset
|
14 hg tags |
26314500a5e1
Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3577
diff
changeset
|
15 rm .hg/localtags |
345 | 16 echo "$T first" > .hgtags |
17 cat .hgtags | |
18 hg add .hgtags | |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
925
diff
changeset
|
19 hg commit -m "add tags" -d "1000000 0" |
345 | 20 hg tags |
21 hg identify | |
22 echo bb > a | |
23 hg status | |
24 hg identify | |
25 hg co first | |
26 hg id | |
27 hg -v id | |
28 hg status | |
29 echo 1 > b | |
30 hg add b | |
1933
7544700fd931
Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
925
diff
changeset
|
31 hg commit -m "branch" -d "1000000 0" |
345 | 32 hg id |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1986
diff
changeset
|
33 hg merge 1 |
345 | 34 hg id |
35 hg status | |
36 | |
1986
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
37 hg commit -m "merge" -d "1000000 0" |
2320
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
38 |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
39 # create fake head, make sure tag not visible afterwards |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
40 cp .hgtags tags |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
41 hg tag -d "1000000 0" last |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
42 hg rm .hgtags |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
43 hg commit -m "remove" -d "1000000 0" |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
44 |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
45 mv tags .hgtags |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
46 hg add .hgtags |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
47 hg commit -m "readd" -d "1000000 0" |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
48 |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
49 hg tags |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
50 |
1986
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
51 # invalid tags |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
52 echo "spam" >> .hgtags |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
53 echo >> .hgtags |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
54 echo "foo bar" >> .hgtags |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
55 echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
56 hg commit -m "tags" -d "1000000 0" |
2320
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
57 |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
58 # report tag parse error on other head |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
59 hg up 3 |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
60 echo 'x y' >> .hgtags |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
61 hg commit -m "head" -d "1000000 0" |
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
62 |
1986
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
63 hg tags |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
64 hg tip |
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
65 |
4211
e29f2db5ab18
Make the tags algorithm smarter
Matt Mackall <mpm@selenic.com>
parents:
4143
diff
changeset
|
66 # test tag precedence rules |
3577
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
67 cd .. |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
68 hg init t2 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
69 cd t2 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
70 echo foo > foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
71 hg add foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
72 hg ci -m 'add foo' -d '1000000 0' # rev 0 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
73 hg tag -d '1000000 0' bar # rev 1 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
74 echo >> foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
75 hg ci -m 'change foo 1' -d '1000000 0' # rev 2 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
76 hg up -C 1 |
4267
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
77 hg tag -r 1 -d '1000000 0' -f bar # rev 3 |
3577
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
78 hg up -C 1 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
79 echo >> foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
80 hg ci -m 'change foo 2' -d '1000000 0' # rev 4 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2966
diff
changeset
|
81 hg tags |
4213 | 82 |
4266
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
83 # test tag removal |
4659
7a7d4937272b
Kill trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4651
diff
changeset
|
84 hg tag --remove -d '1000000 0' bar |
4213 | 85 hg tip |
86 hg tags | |
4266
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
87 |
4651
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4482
diff
changeset
|
88 echo '% remove nonexistent tag' |
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4482
diff
changeset
|
89 hg tag --remove -d '1000000 0' foobar |
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4482
diff
changeset
|
90 hg tip |
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4482
diff
changeset
|
91 |
4266
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
92 # test tag rank |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
93 cd .. |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
94 hg init t3 |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
95 cd t3 |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
96 echo foo > foo |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
97 hg add foo |
4267
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
98 hg ci -m 'add foo' -d '1000000 0' # rev 0 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
99 hg tag -d '1000000 0' -f bar # rev 1 bar -> 0 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
100 hg tag -d '1000000 0' -f bar # rev 2 bar -> 1 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
101 hg tag -d '1000000 0' -fr 0 bar # rev 3 bar -> 0 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
102 hg tag -d '1000000 0' -fr 1 bar # rev 3 bar -> 1 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
103 hg tag -d '1000000 0' -fr 0 bar # rev 4 bar -> 0 |
4266
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
104 hg tags |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
105 hg co 3 |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
106 echo barbar > foo |
4267
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
107 hg ci -m 'change foo' -d '1000000 0' # rev 0 |
4266
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
108 hg tags |
4267
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
109 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
110 hg tag -d '1000000 0' -r 3 bar # should complain |
4482
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
111 hg tags |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
112 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
113 # test tag rank with 3 heads |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
114 cd .. |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
115 hg init t4 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
116 cd t4 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
117 echo foo > foo |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
118 hg add |
5524
453acf64f71f
run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4659
diff
changeset
|
119 hg ci -m 'add foo' # rev 0 |
453acf64f71f
run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4659
diff
changeset
|
120 hg tag bar # rev 1 bar -> 0 |
453acf64f71f
run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4659
diff
changeset
|
121 hg tag -f bar # rev 2 bar -> 1 |
4482
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
122 hg up -qC 0 |
5524
453acf64f71f
run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4659
diff
changeset
|
123 hg tag -fr 2 bar # rev 3 bar -> 2 |
4482
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
124 hg tags |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
125 hg up -qC 0 |
5524
453acf64f71f
run-tests.py: add a default --date "0 0" argument to commit et al
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4659
diff
changeset
|
126 hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 |
4482
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
127 echo % bar should still point to rev 2 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
128 hg tags |
5657
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
129 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
130 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
131 # test that removing global/local tags does not get confused when trying |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
132 # to remove a tag of type X which actually only exists as a type Y |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
133 cd .. |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
134 hg init t5 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
135 cd t5 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
136 echo foo > foo |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
137 hg add |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
138 hg ci -m 'add foo' # rev 0 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
139 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
140 hg tag -r 0 -l localtag |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
141 hg tag --remove localtag |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
142 |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
143 hg tag -r 0 globaltag |
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
144 hg tag --remove -l globaltag |
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
145 hg tags -v |
5657
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
146 exit 0 |