Mercurial > hg
annotate tests/test-tags.t @ 24545:9e0c67e84896
json: implement {tags} template
Tags is pretty easy to implement. Let's start there.
The output is slightly different from `hg tags -Tjson`. For reference,
the CLI has the following output:
[
{
"node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
"rev": 29880,
"tag": "tip",
"type": ""
},
...
]
Our output has the format:
{
"node": "0aeb19ea57a6d223bacddda3871cb78f24b06510",
"tags": [
{
"node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
"tag": "tag1",
"date": [1427775457.0, 25200]
},
...
]
}
"rev" is omitted because it isn't a reliable identifier. We shouldn't
be exposing them in web APIs and giving the impression it remotely
resembles a stable identifier. Perhaps we could one day hide this behind
a config option (it might be useful to expose when running servers
locally).
The "type" of the tag isn't defined because this information isn't yet
exposed to the hgweb templater (it could be in a follow-up) and because
it is questionable whether different types should be exposed at all.
(Should the web interface really be exposing "local" tags?)
We use an object for the outer type instead of Array for a few reasons.
First, it is extensible. If we ever need to throw more global properties
into the output, we can do that without breaking backwards compatibility
(property additions should be backwards compatible). Second, uniformity
in web APIs is nice. Having everything return objects seems much saner than
a mix of array and object. Third, there are security issues with arrays
in older browsers. The JSON web services world almost never uses arrays
as the main type for this reason.
Another possibly controversial part about this patch is how dates are
defined. While JSON has a Date type, it is based on the JavaScript Date
type, which is widely considered a pile of garbage. It is a non-starter
for this reason.
Many of Mercurial's built-in date filters drop seconds resolution. So
that's a non-starter as well, since we want the API to be lossless where
possible. rfc3339date, rfc822date, isodatesec, and date are all lossless.
However, they each require the client to perform string parsing on top of
JSON decoding. While date parsing libraries are pretty ubiquitous, some
languages don't have them out of the box. However, pretty much every
programming language can deal with UNIX timestamps (which are just
integers or floats). So, we choose to use Mercurial's internal date
representation, which in JSON is modeled as float seconds since UNIX
epoch and an integer timezone offset from UTC (keep in mind
JavaScript/JSON models all "Numbers" as double prevision floating point
numbers, so there isn't a difference between ints and floats in JSON).
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 14:52:21 -0700 |
parents | f5de208a635c |
children | 5150b2b5b345 |
rev | line source |
---|---|
11744 | 1 Helper functions: |
2 | |
3 $ cacheexists() { | |
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
12763
diff
changeset
|
4 > [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache" |
11744 | 5 > } |
345 | 6 |
11744 | 7 $ dumptags() { |
8 > rev=$1 | |
9 > echo "rev $rev: .hgtags:" | |
10 > hg cat -r$rev .hgtags | |
11 > } | |
9151
f528d1a93491
tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
9144
diff
changeset
|
12 |
9152
4017291c4c48
tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents:
9151
diff
changeset
|
13 # XXX need to test that the tag cache works when we strip an old head |
4017291c4c48
tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents:
9151
diff
changeset
|
14 # and add a new one rooted off non-tip: i.e. node and rev of tip are the |
4017291c4c48
tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents:
9151
diff
changeset
|
15 # same, but stuff has changed behind tip. |
4017291c4c48
tags: support 'instant' tag retrieval (issue548)
Greg Ward <greg-hg@gerg.ca>
parents:
9151
diff
changeset
|
16 |
11744 | 17 Setup: |
9143
a604c98dbf62
test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
5658
diff
changeset
|
18 |
11744 | 19 $ hg init t |
20 $ cd t | |
21 $ cacheexists | |
22 no tag cache | |
23 $ hg id | |
24 000000000000 tip | |
25 $ cacheexists | |
26 no tag cache | |
27 $ echo a > a | |
28 $ hg add a | |
29 $ hg commit -m "test" | |
30 $ hg co | |
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
32 $ hg identify | |
33 acb14030fe0a tip | |
34 $ cacheexists | |
35 tag cache exists | |
36 | |
12758
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
37 Try corrupting the cache |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
38 |
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
12763
diff
changeset
|
39 $ printf 'a b' > .hg/cache/tags |
12758
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
40 $ hg identify |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
41 acb14030fe0a tip |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
42 $ cacheexists |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
43 tag cache exists |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
44 $ hg identify |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
45 acb14030fe0a tip |
2d754eae430c
tags: do not fail if tags.cache is corrupted (issue2444)
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12640
diff
changeset
|
46 |
11744 | 47 Create local tag with long name: |
48 | |
49 $ T=`hg identify --debug --id` | |
50 $ hg tag -l "This is a local tag with a really long name!" | |
51 $ hg tags | |
52 tip 0:acb14030fe0a | |
53 This is a local tag with a really long name! 0:acb14030fe0a | |
54 $ rm .hg/localtags | |
55 | |
56 Create a tag behind hg's back: | |
9143
a604c98dbf62
test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
5658
diff
changeset
|
57 |
11744 | 58 $ echo "$T first" > .hgtags |
59 $ cat .hgtags | |
60 acb14030fe0a21b60322c440ad2d20cf7685a376 first | |
61 $ hg add .hgtags | |
62 $ hg commit -m "add tags" | |
63 $ hg tags | |
64 tip 1:b9154636be93 | |
65 first 0:acb14030fe0a | |
66 $ hg identify | |
67 b9154636be93 tip | |
68 | |
69 Repeat with cold tag cache: | |
70 | |
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
12763
diff
changeset
|
71 $ rm -f .hg/cache/tags |
11744 | 72 $ hg identify |
73 b9154636be93 tip | |
74 | |
75 And again, but now unable to write tag cache: | |
9143
a604c98dbf62
test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
5658
diff
changeset
|
76 |
16857
1415edd88c56
test-tags: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
15443
diff
changeset
|
77 #if unix-permissions |
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
12763
diff
changeset
|
78 $ rm -f .hg/cache/tags |
11744 | 79 $ chmod 555 .hg |
80 $ hg identify | |
81 b9154636be93 tip | |
82 $ chmod 755 .hg | |
16857
1415edd88c56
test-tags: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
15443
diff
changeset
|
83 #endif |
11744 | 84 |
85 Create a branch: | |
9151
f528d1a93491
tags: implement persistent tag caching (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
9144
diff
changeset
|
86 |
11744 | 87 $ echo bb > a |
88 $ hg status | |
89 M a | |
90 $ hg identify | |
91 b9154636be93+ tip | |
92 $ hg co first | |
93 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
94 $ hg id | |
95 acb14030fe0a+ first | |
96 $ hg -v id | |
97 acb14030fe0a+ first | |
98 $ hg status | |
99 M a | |
100 $ echo 1 > b | |
101 $ hg add b | |
102 $ hg commit -m "branch" | |
103 created new head | |
104 $ hg id | |
105 c8edf04160c7 tip | |
106 | |
107 Merge the two heads: | |
9366
9ff178e7b627
tags: don't crash if unable to write tag cache
Greg Ward <greg-hg@gerg.ca>
parents:
9152
diff
changeset
|
108 |
11744 | 109 $ hg merge 1 |
110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
111 (branch merge, don't forget to commit) | |
112 $ hg id | |
113 c8edf04160c7+b9154636be93+ tip | |
114 $ hg status | |
115 M .hgtags | |
116 $ hg commit -m "merge" | |
117 | |
118 Create a fake head, make sure tag not visible afterwards: | |
119 | |
120 $ cp .hgtags tags | |
121 $ hg tag last | |
122 $ hg rm .hgtags | |
123 $ hg commit -m "remove" | |
9143
a604c98dbf62
test-tags: clarify test output; simplify test script a bit (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
5658
diff
changeset
|
124 |
11744 | 125 $ mv tags .hgtags |
126 $ hg add .hgtags | |
127 $ hg commit -m "readd" | |
128 $ | |
129 $ hg tags | |
130 tip 6:35ff301afafe | |
131 first 0:acb14030fe0a | |
132 | |
133 Add invalid tags: | |
345 | 134 |
11744 | 135 $ echo "spam" >> .hgtags |
136 $ echo >> .hgtags | |
137 $ echo "foo bar" >> .hgtags | |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12327
diff
changeset
|
138 $ echo "a5a5 invalid" >> .hg/localtags |
17345
4f8054d3171b
check-code: fix check for trailing whitespace on sh command lines
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
139 $ cat .hgtags |
11744 | 140 acb14030fe0a21b60322c440ad2d20cf7685a376 first |
141 spam | |
142 | |
143 foo bar | |
144 $ hg commit -m "tags" | |
145 | |
146 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
|
147 |
11744 | 148 $ hg up 3 |
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
150 $ echo 'x y' >> .hgtags | |
151 $ hg commit -m "head" | |
152 created new 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
|
153 |
11744 | 154 $ hg tags |
155 .hgtags@75d9f02dfe28, line 2: cannot parse entry | |
156 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed | |
157 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed | |
158 tip 8:c4be69a18c11 | |
159 first 0:acb14030fe0a | |
160 $ hg tip | |
161 changeset: 8:c4be69a18c11 | |
162 tag: tip | |
163 parent: 3:ac5e980c4dc0 | |
164 user: test | |
165 date: Thu Jan 01 00:00:00 1970 +0000 | |
166 summary: head | |
167 | |
2320
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
168 |
11744 | 169 Test tag precedence rules: |
2320
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
170 |
11744 | 171 $ cd .. |
172 $ hg init t2 | |
173 $ cd t2 | |
174 $ echo foo > foo | |
175 $ hg add foo | |
176 $ hg ci -m 'add foo' # rev 0 | |
177 $ hg tag bar # rev 1 | |
178 $ echo >> foo | |
179 $ hg ci -m 'change foo 1' # rev 2 | |
180 $ hg up -C 1 | |
181 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
182 $ hg tag -r 1 -f bar # rev 3 | |
183 $ hg up -C 1 | |
184 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
185 $ echo >> foo | |
186 $ hg ci -m 'change foo 2' # rev 4 | |
187 created new head | |
188 $ hg tags | |
189 tip 4:0c192d7d5e6b | |
190 bar 1:78391a272241 | |
2320
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
191 |
11744 | 192 Repeat in case of cache effects: |
2320
dbdce3b99988
fix parsing of tags. make parse errors useful. add new tag tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2283
diff
changeset
|
193 |
11744 | 194 $ hg tags |
195 tip 4:0c192d7d5e6b | |
196 bar 1:78391a272241 | |
197 | |
198 Detailed dump of tag info: | |
1986
719cf07b076d
add checking for invalid entries in tag files
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1933
diff
changeset
|
199 |
11744 | 200 $ hg heads -q # expect 4, 3, 2 |
201 4:0c192d7d5e6b | |
202 3:6fa450212aeb | |
203 2:7a94127795a3 | |
204 $ dumptags 2 | |
205 rev 2: .hgtags: | |
206 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar | |
207 $ dumptags 3 | |
208 rev 3: .hgtags: | |
209 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar | |
210 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar | |
211 78391a272241d70354aa14c874552cad6b51bb42 bar | |
212 $ dumptags 4 | |
213 rev 4: .hgtags: | |
214 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar | |
9144
ad72e3b08bc0
test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
9143
diff
changeset
|
215 |
11744 | 216 Dump cache: |
217 | |
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
12763
diff
changeset
|
218 $ cat .hg/cache/tags |
11744 | 219 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d |
220 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0 | |
221 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d | |
222 | |
19646
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
223 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
224 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
11744 | 225 78391a272241d70354aa14c874552cad6b51bb42 bar |
226 | |
227 Test tag removal: | |
9144
ad72e3b08bc0
test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
9143
diff
changeset
|
228 |
11744 | 229 $ hg tag --remove bar # rev 5 |
230 $ hg tip -vp | |
231 changeset: 5:5f6e8655b1c7 | |
232 tag: tip | |
233 user: test | |
234 date: Thu Jan 01 00:00:00 1970 +0000 | |
235 files: .hgtags | |
236 description: | |
237 Removed tag bar | |
238 | |
239 | |
240 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags | |
241 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |
242 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |
243 @@ -1,1 +1,3 @@ | |
244 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar | |
245 +78391a272241d70354aa14c874552cad6b51bb42 bar | |
246 +0000000000000000000000000000000000000000 bar | |
247 | |
248 $ hg tags | |
249 tip 5:5f6e8655b1c7 | |
250 $ hg tags # again, try to expose cache bugs | |
251 tip 5:5f6e8655b1c7 | |
4213 | 252 |
11744 | 253 Remove nonexistent tag: |
254 | |
255 $ hg tag --remove foobar | |
256 abort: tag 'foobar' does not exist | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11744
diff
changeset
|
257 [255] |
11744 | 258 $ hg tip |
259 changeset: 5:5f6e8655b1c7 | |
260 tag: tip | |
261 user: test | |
262 date: Thu Jan 01 00:00:00 1970 +0000 | |
263 summary: Removed tag bar | |
264 | |
4266
fe7f38dda34b
tags: fix abababa case, with test case
Matt Mackall <mpm@selenic.com>
parents:
4213
diff
changeset
|
265 |
11744 | 266 Undo a tag with rollback: |
4651
7176f278d6f9
Test attempt to remove nonexistent tag
Brendan Cully <brendan@kublai.com>
parents:
4482
diff
changeset
|
267 |
11744 | 268 $ hg rollback # destroy rev 5 (restore bar) |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13272
diff
changeset
|
269 repository tip rolled back to revision 4 (undo commit) |
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13272
diff
changeset
|
270 working directory now based on revision 4 |
11744 | 271 $ hg tags |
272 tip 4:0c192d7d5e6b | |
273 bar 1:78391a272241 | |
274 $ hg tags | |
275 tip 4:0c192d7d5e6b | |
276 bar 1:78391a272241 | |
277 | |
278 Test tag rank: | |
9144
ad72e3b08bc0
test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
9143
diff
changeset
|
279 |
11744 | 280 $ cd .. |
281 $ hg init t3 | |
282 $ cd t3 | |
283 $ echo foo > foo | |
284 $ hg add foo | |
285 $ hg ci -m 'add foo' # rev 0 | |
286 $ hg tag -f bar # rev 1 bar -> 0 | |
287 $ hg tag -f bar # rev 2 bar -> 1 | |
288 $ hg tag -fr 0 bar # rev 3 bar -> 0 | |
289 $ hg tag -fr 1 bar # rev 4 bar -> 1 | |
290 $ hg tag -fr 0 bar # rev 5 bar -> 0 | |
291 $ hg tags | |
292 tip 5:85f05169d91d | |
293 bar 0:bbd179dfa0a7 | |
294 $ hg co 3 | |
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
296 $ echo barbar > foo | |
297 $ hg ci -m 'change foo' # rev 6 | |
298 created new head | |
299 $ hg tags | |
300 tip 6:735c3ca72986 | |
301 bar 0:bbd179dfa0a7 | |
4267
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4266
diff
changeset
|
302 |
11744 | 303 Don't allow moving tag without -f: |
304 | |
305 $ hg tag -r 3 bar | |
306 abort: tag 'bar' already exists (use -f to force) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11744
diff
changeset
|
307 [255] |
11744 | 308 $ hg tags |
309 tip 6:735c3ca72986 | |
310 bar 0:bbd179dfa0a7 | |
311 | |
312 Strip 1: expose an old head: | |
4482
99f411ba0380
use .extend instead of .append in readtags
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
313 |
11744 | 314 $ hg --config extensions.mq= strip 5 |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
315 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) |
11744 | 316 $ hg tags # partly stale cache |
317 tip 5:735c3ca72986 | |
318 bar 1:78391a272241 | |
319 $ hg tags # up-to-date cache | |
320 tip 5:735c3ca72986 | |
321 bar 1:78391a272241 | |
322 | |
323 Strip 2: destroy whole branch, no old head exposed | |
9144
ad72e3b08bc0
test-tags: enhance the test to probe tag caching better (issue548).
Greg Ward <greg-hg@gerg.ca>
parents:
9143
diff
changeset
|
324 |
11744 | 325 $ hg --config extensions.mq= strip 4 |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
326 saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) |
11744 | 327 $ hg tags # partly stale |
328 tip 4:735c3ca72986 | |
329 bar 0:bbd179dfa0a7 | |
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
12763
diff
changeset
|
330 $ rm -f .hg/cache/tags |
11744 | 331 $ hg tags # cold cache |
332 tip 4:735c3ca72986 | |
333 bar 0:bbd179dfa0a7 | |
334 | |
335 Test tag rank with 3 heads: | |
5657
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
336 |
11744 | 337 $ cd .. |
338 $ hg init t4 | |
339 $ cd t4 | |
340 $ echo foo > foo | |
341 $ hg add | |
342 adding foo | |
343 $ hg ci -m 'add foo' # rev 0 | |
344 $ hg tag bar # rev 1 bar -> 0 | |
345 $ hg tag -f bar # rev 2 bar -> 1 | |
346 $ hg up -qC 0 | |
347 $ hg tag -fr 2 bar # rev 3 bar -> 2 | |
348 $ hg tags | |
349 tip 3:197c21bbbf2c | |
350 bar 2:6fa450212aeb | |
351 $ hg up -qC 0 | |
352 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 | |
5657
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
353 |
11744 | 354 Bar should still point to rev 2: |
355 | |
356 $ hg tags | |
357 tip 4:3b4b14ed0202 | |
358 bar 2:6fa450212aeb | |
359 | |
360 Test that removing global/local tags does not get confused when trying | |
361 to remove a tag of type X which actually only exists as a type Y: | |
5657
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
362 |
11744 | 363 $ cd .. |
364 $ hg init t5 | |
365 $ cd t5 | |
366 $ echo foo > foo | |
367 $ hg add | |
368 adding foo | |
369 $ hg ci -m 'add foo' # rev 0 | |
5657
47915bf68c44
Properly check tag's existence as a local/global tag when removing it.
Osku Salerma <osku@iki.fi>
parents:
5524
diff
changeset
|
370 |
11744 | 371 $ hg tag -r 0 -l localtag |
372 $ hg tag --remove localtag | |
373 abort: tag 'localtag' is not a global tag | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11744
diff
changeset
|
374 [255] |
11744 | 375 $ |
376 $ hg tag -r 0 globaltag | |
377 $ hg tag --remove -l globaltag | |
378 abort: tag 'globaltag' is not a local tag | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11744
diff
changeset
|
379 [255] |
11744 | 380 $ hg tags -v |
381 tip 1:a0b6fe111088 | |
382 localtag 0:bbd179dfa0a7 local | |
383 globaltag 0:bbd179dfa0a7 | |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16857
diff
changeset
|
384 |
19108
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
385 Test for issue3911 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
386 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
387 $ hg tag -r 0 -l localtag2 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
388 $ hg tag -l --remove localtag2 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
389 $ hg tags -v |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
390 tip 1:a0b6fe111088 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
391 localtag 0:bbd179dfa0a7 local |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
392 globaltag 0:bbd179dfa0a7 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
393 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
394 $ hg tag -r 1 -f localtag |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
395 $ hg tags -v |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
396 tip 2:5c70a037bb37 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
397 localtag 1:a0b6fe111088 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
398 globaltag 0:bbd179dfa0a7 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
399 |
19646
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
400 $ hg tags -v |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
401 tip 2:5c70a037bb37 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
402 localtag 1:a0b6fe111088 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
403 globaltag 0:bbd179dfa0a7 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
404 |
19108
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
405 $ hg tag -r 1 localtag2 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
406 $ hg tags -v |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
407 tip 3:bbfb8cd42be2 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
408 localtag2 1:a0b6fe111088 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
409 localtag 1:a0b6fe111088 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
410 globaltag 0:bbd179dfa0a7 |
cb95716da5fe
tags: update tag type only if tag node is updated (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17345
diff
changeset
|
411 |
19646
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
412 $ hg tags -v |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
413 tip 3:bbfb8cd42be2 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
414 localtag2 1:a0b6fe111088 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
415 localtag 1:a0b6fe111088 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
416 globaltag 0:bbd179dfa0a7 |
335a558f81dc
tags: write tag overwriting history also into tag cache file (issue3911)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19108
diff
changeset
|
417 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16857
diff
changeset
|
418 $ cd .. |