annotate tests/test-tags @ 9151:f528d1a93491

tags: implement persistent tag caching (issue548). - rename findglobaltags() to findglobaltags1() (so the "no cache" implementation is still there if we need it) - add findglobaltags2() and make findglobaltags() an alias for it (disabling tag caching is a one-line patch) - factor out tagcache class with methods readcache() and writecache(); the expensive part of tag finding (iterate over heads and find .hgtags filenode) is now in tagcache.readcache()
author Greg Ward <greg-hg@gerg.ca>
date Thu, 16 Jul 2009 10:39:42 -0400
parents ad72e3b08bc0
children 4017291c4c48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
2
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
3 cacheexists() {
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
4 [ -f .hg/tags.cache ] && echo "tag cache exists" || echo "no tag cache"
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
5 }
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
6
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
7 echo "% setup"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
8 mkdir t
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
9 cd t
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
10 hg init
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
11 cacheexists
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
12 hg id
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
13 cacheexists
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
14 echo a > a
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
15 hg add a
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
16 hg commit -m "test"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
17 hg co
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
18 hg identify
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
19 cacheexists
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
20
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
21 echo "% create local tag with long name"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
22 T=`hg identify --debug --id`
4143
26314500a5e1 Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3577
diff changeset
23 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
24 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
25 rm .hg/localtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
26
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
27 echo "% create a tag behind hg's back"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
28 echo "$T first" > .hgtags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
29 cat .hgtags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
30 hg add .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
31 hg commit -m "add tags"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
32 hg tags
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
33 hg identify
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
34
9151
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
35 # repeat with cold tag cache
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
36 rm -f .hg/tags.cache
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
37 hg identify
f528d1a93491 tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9144
diff changeset
38
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
39 echo "% create a branch"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
40 echo bb > a
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
41 hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
42 hg identify
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
43 hg co first
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
44 hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
45 hg -v id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
46 hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
47 echo 1 > b
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
48 hg add b
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
49 hg commit -m "branch"
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
50 hg id
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
51
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
52 echo "% merge the two heads"
2283
e506c14382fd deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1986
diff changeset
53 hg merge 1
345
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
54 hg id
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
55 hg status
9d8d9207c0b3 Add a tags/identify test group
mpm@selenic.com
parents:
diff changeset
56
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
57 hg commit -m "merge"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
58
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
59 echo "% create fake head, make sure tag not visible afterwards"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
60 cp .hgtags tags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
61 hg tag last
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
62 hg rm .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
63 hg commit -m "remove"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
64
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
65 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
66 hg add .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
67 hg commit -m "readd"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
68
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
69 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
70
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
71 echo "% add invalid tags"
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
72 echo "spam" >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
73 echo >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
74 echo "foo bar" >> .hgtags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
75 echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
76 echo "committing .hgtags:"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
77 cat .hgtags
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
78 hg commit -m "tags"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
79
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
80 echo "% report tag parse error on other head"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
81 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
82 echo 'x y' >> .hgtags
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
83 hg commit -m "head"
2320
dbdce3b99988 fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2283
diff changeset
84
1986
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
85 hg tags
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
86 hg tip
719cf07b076d add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
87
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
88 echo "% 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
89 cd ..
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
90 hg init t2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
91 cd t2
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
92 echo foo > foo
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
93 hg add foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
94 hg ci -m 'add foo' # rev 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
95 hg tag bar # rev 1
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
96 echo >> foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
97 hg ci -m 'change foo 1' # rev 2
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
98 hg up -C 1
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
99 hg tag -r 1 -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
100 hg up -C 1
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
101 echo >> foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
102 hg ci -m 'change foo 2' # rev 4
3577
7f7425306925 Correct optimization from 3464f5e77f34; add a test.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 2966
diff changeset
103 hg tags
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
104 hg tags # repeat in case of cache effects
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
105
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
106 dumptags() {
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
107 rev=$1
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
108 echo "rev $rev: .hgtags:"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
109 hg cat -r$rev .hgtags
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
110 }
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
111
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
112 echo "% detailed dump of tag info"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
113 echo "heads:"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
114 hg heads -q # expect 4, 3, 2
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
115 dumptags 2
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
116 dumptags 3
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
117 dumptags 4
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
118 echo ".hg/tags.cache:"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
119 [ -f .hg/tags.cache ] && cat .hg/tags.cache || echo "no such file"
4213
3be4785f8994 tags: add --remove
Matt Mackall <mpm@selenic.com>
parents: 4211
diff changeset
120
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
121 echo "% test tag removal"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
122 hg tag --remove bar # rev 5
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
123 hg tip -vp
4213
3be4785f8994 tags: add --remove
Matt Mackall <mpm@selenic.com>
parents: 4211
diff changeset
124 hg tags
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
125 hg tags # again, try to expose cache bugs
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
126
4651
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
127 echo '% remove nonexistent tag'
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
128 hg tag --remove foobar
4651
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
129 hg tip
7176f278d6f9 Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents: 4482
diff changeset
130
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
131 echo "% rollback undoes tag operation"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
132 hg rollback # destroy rev 5 (restore bar)
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
133 hg tags
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
134 hg tags
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
135
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
136 echo "% test tag rank"
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
137 cd ..
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
138 hg init t3
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
139 cd t3
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
140 echo foo > foo
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
141 hg add foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
142 hg ci -m 'add foo' # rev 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
143 hg tag -f bar # rev 1 bar -> 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
144 hg tag -f bar # rev 2 bar -> 1
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
145 hg tag -fr 0 bar # rev 3 bar -> 0
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
146 hg tag -fr 1 bar # rev 4 bar -> 1
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
147 hg tag -fr 0 bar # rev 5 bar -> 0
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
148 hg tags
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
149 hg co 3
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
150 echo barbar > foo
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
151 hg ci -m 'change foo' # rev 6
4266
fe7f38dda34b tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents: 4213
diff changeset
152 hg tags
4267
8185a1ca8628 tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents: 4266
diff changeset
153
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
154 echo "% don't allow moving tag without -f"
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
155 hg tag -r 3 bar
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
156 hg tags
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
157
9144
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
158 echo "% strip 1: expose an old head"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
159 hg --config extensions.mq= strip 5 > /dev/null 2>&1
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
160 hg tags # partly stale cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
161 hg tags # up-to-date cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
162 echo "% strip 2: destroy whole branch, no old head exposed"
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
163 hg --config extensions.mq= strip 4 > /dev/null 2>&1
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
164 hg tags # partly stale
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
165 rm -f .hg/tags.cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
166 hg tags # cold cache
ad72e3b08bc0 test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 9143
diff changeset
167
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
168 echo "% test tag rank with 3 heads"
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
169 cd ..
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
170 hg init t4
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
171 cd t4
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
172 echo foo > foo
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
173 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
174 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
175 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
176 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
177 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
178 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
179 hg tags
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
180 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
181 hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
182 echo "% bar should still point to rev 2"
4482
99f411ba0380 use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4267
diff changeset
183 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
184
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
185
9143
a604c98dbf62 test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents: 5658
diff changeset
186 echo "% remove local as global and global as local"
5657
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
187 # 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
188 # 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
189 cd ..
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
190 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
191 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
192 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
193 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
194 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
195
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
196 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
197 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
198
47915bf68c44 Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents: 5524
diff changeset
199 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
200 hg tag --remove -l globaltag
5658
ae3089cefaab Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents: 5657
diff changeset
201 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
202 exit 0