Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-tags @ 5483:0c43f87baba3 default tip
Fix file-changed-to-dir and dir-to-file commits (issue660).
Allow adding to dirstate files that clash with previously existing
but marked for removal. Protect from reintroducing clashes by revert.
This change doesn't address related issues with update. Current
workaround is to do "clean" update by manually removing conflicting
files/dirs from working directory.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 27 Oct 2007 16:27:55 +0400 |
parents | 7a7d4937272b |
children |
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 | |
2973
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 |
4215
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:
2973
diff
changeset
|
67 cd .. |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
diff
changeset
|
68 hg init t2 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
diff
changeset
|
69 cd t2 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
diff
changeset
|
70 echo foo > foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
diff
changeset
|
71 hg add foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
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:
2973
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:
2973
diff
changeset
|
74 echo >> foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
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:
2973
diff
changeset
|
76 hg up -C 1 |
4273
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4272
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:
2973
diff
changeset
|
78 hg up -C 1 |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
diff
changeset
|
79 echo >> foo |
7f7425306925
Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2973
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:
2973
diff
changeset
|
81 hg tags |
4217 | 82 |
4272
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
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 |
4217 | 85 hg tip |
86 hg tags | |
4272
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
87 |
4651
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4494
diff
changeset
|
88 echo '% remove nonexistent tag' |
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4494
diff
changeset
|
89 hg tag --remove -d '1000000 0' foobar |
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4494
diff
changeset
|
90 hg tip |
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4494
diff
changeset
|
91 |
4272
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
92 # test tag rank |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
93 cd .. |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
94 hg init t3 |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
95 cd t3 |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
96 echo foo > foo |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
97 hg add foo |
4273
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4272
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:
4272
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:
4272
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:
4272
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:
4272
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:
4272
diff
changeset
|
103 hg tag -d '1000000 0' -fr 0 bar # rev 4 bar -> 0 |
4272
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
104 hg tags |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
105 hg co 3 |
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
106 echo barbar > foo |
4273
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4272
diff
changeset
|
107 hg ci -m 'change foo' -d '1000000 0' # rev 0 |
4272
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4217
diff
changeset
|
108 hg tags |
4273
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4272
diff
changeset
|
109 |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4272
diff
changeset
|
110 hg tag -d '1000000 0' -r 3 bar # should complain |
4494
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
111 hg tags |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
112 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
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:
4273
diff
changeset
|
114 cd .. |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
115 hg init t4 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
116 cd t4 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
117 echo foo > foo |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
118 hg add |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
119 hg ci -m 'add foo' -d '0 0' # rev 0 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
120 hg tag -d '0 0' bar # rev 1 bar -> 0 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
121 hg tag -d '0 0' -f bar # rev 2 bar -> 1 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
122 hg up -qC 0 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
123 hg tag -d '0 0' -fr 2 bar # rev 3 bar -> 2 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
124 hg tags |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
125 hg up -qC 0 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
diff
changeset
|
126 hg tag -d '0 0' -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 |
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4273
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:
4273
diff
changeset
|
128 hg tags |