Show More
@@ -1,622 +1,622 | |||
|
1 | 1 | setup |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH << EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > blackbox= |
|
6 | 6 | > mock=$TESTDIR/mockblackbox.py |
|
7 | 7 | > EOF |
|
8 | 8 | |
|
9 | 9 | Helper functions: |
|
10 | 10 | |
|
11 | 11 | $ cacheexists() { |
|
12 | 12 | > [ -f .hg/cache/tags2-visible ] && echo "tag cache exists" || echo "no tag cache" |
|
13 | 13 | > } |
|
14 | 14 | |
|
15 | 15 | $ fnodescacheexists() { |
|
16 | 16 | > [ -f .hg/cache/hgtagsfnodes1 ] && echo "fnodes cache exists" || echo "no fnodes cache" |
|
17 | 17 | > } |
|
18 | 18 | |
|
19 | 19 | $ dumptags() { |
|
20 | 20 | > rev=$1 |
|
21 | 21 | > echo "rev $rev: .hgtags:" |
|
22 | 22 | > hg cat -r$rev .hgtags |
|
23 | 23 | > } |
|
24 | 24 | |
|
25 | 25 | # XXX need to test that the tag cache works when we strip an old head |
|
26 | 26 | # and add a new one rooted off non-tip: i.e. node and rev of tip are the |
|
27 | 27 | # same, but stuff has changed behind tip. |
|
28 | 28 | |
|
29 | 29 | Setup: |
|
30 | 30 | |
|
31 | 31 | $ hg init t |
|
32 | 32 | $ cd t |
|
33 | 33 | $ cacheexists |
|
34 | 34 | no tag cache |
|
35 | 35 | $ fnodescacheexists |
|
36 | 36 | no fnodes cache |
|
37 | 37 | $ hg id |
|
38 | 38 | 000000000000 tip |
|
39 | 39 | $ cacheexists |
|
40 | 40 | no tag cache |
|
41 | 41 | $ fnodescacheexists |
|
42 | 42 | no fnodes cache |
|
43 | 43 | $ echo a > a |
|
44 | 44 | $ hg add a |
|
45 | 45 | $ hg commit -m "test" |
|
46 | 46 | $ hg co |
|
47 | 47 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
48 | 48 | $ hg identify |
|
49 | 49 | acb14030fe0a tip |
|
50 | 50 | $ cacheexists |
|
51 | 51 | tag cache exists |
|
52 | 52 | No fnodes cache because .hgtags file doesn't exist |
|
53 | 53 | (this is an implementation detail) |
|
54 | 54 | $ fnodescacheexists |
|
55 | 55 | no fnodes cache |
|
56 | 56 | |
|
57 | 57 | Try corrupting the cache |
|
58 | 58 | |
|
59 | 59 | $ printf 'a b' > .hg/cache/tags2-visible |
|
60 | 60 | $ hg identify |
|
61 | 61 | acb14030fe0a tip |
|
62 | 62 | $ cacheexists |
|
63 | 63 | tag cache exists |
|
64 | 64 | $ fnodescacheexists |
|
65 | 65 | no fnodes cache |
|
66 | 66 | $ hg identify |
|
67 | 67 | acb14030fe0a tip |
|
68 | 68 | |
|
69 | 69 | Create local tag with long name: |
|
70 | 70 | |
|
71 | 71 | $ T=`hg identify --debug --id` |
|
72 | 72 | $ hg tag -l "This is a local tag with a really long name!" |
|
73 | 73 | $ hg tags |
|
74 | 74 | tip 0:acb14030fe0a |
|
75 | 75 | This is a local tag with a really long name! 0:acb14030fe0a |
|
76 | 76 | $ rm .hg/localtags |
|
77 | 77 | |
|
78 | 78 | Create a tag behind hg's back: |
|
79 | 79 | |
|
80 | 80 | $ echo "$T first" > .hgtags |
|
81 | 81 | $ cat .hgtags |
|
82 | 82 | acb14030fe0a21b60322c440ad2d20cf7685a376 first |
|
83 | 83 | $ hg add .hgtags |
|
84 | 84 | $ hg commit -m "add tags" |
|
85 | 85 | $ hg tags |
|
86 | 86 | tip 1:b9154636be93 |
|
87 | 87 | first 0:acb14030fe0a |
|
88 | 88 | $ hg identify |
|
89 | 89 | b9154636be93 tip |
|
90 | 90 | |
|
91 | 91 | We should have a fnodes cache now that we have a real tag |
|
92 | 92 | The cache should have an empty entry for rev 0 and a valid entry for rev 1. |
|
93 | 93 | |
|
94 | 94 | |
|
95 | 95 | $ fnodescacheexists |
|
96 | 96 | fnodes cache exists |
|
97 | 97 | $ f --size --hexdump .hg/cache/hgtagsfnodes1 |
|
98 | 98 | .hg/cache/hgtagsfnodes1: size=48 |
|
99 | 99 | 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
100 | 100 | 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...| |
|
101 | 101 | 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| |
|
102 | 102 | |
|
103 | 103 | Repeat with cold tag cache: |
|
104 | 104 | |
|
105 | 105 | $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1 |
|
106 | 106 | $ hg identify |
|
107 | 107 | b9154636be93 tip |
|
108 | 108 | |
|
109 | 109 | $ fnodescacheexists |
|
110 | 110 | fnodes cache exists |
|
111 | 111 | $ f --size --hexdump .hg/cache/hgtagsfnodes1 |
|
112 | 112 | .hg/cache/hgtagsfnodes1: size=48 |
|
113 | 113 | 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
114 | 114 | 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...| |
|
115 | 115 | 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| |
|
116 | 116 | |
|
117 | 117 | And again, but now unable to write tag cache: |
|
118 | 118 | |
|
119 | 119 | #if unix-permissions |
|
120 | 120 | $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1 |
|
121 | 121 | $ chmod 555 .hg/cache |
|
122 | 122 | $ hg identify |
|
123 | 123 | b9154636be93 tip |
|
124 | 124 | $ chmod 755 .hg/cache |
|
125 | 125 | #endif |
|
126 | 126 | |
|
127 | 127 | Tag cache debug info written to blackbox log |
|
128 | 128 | |
|
129 | 129 | $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1 |
|
130 | 130 | $ hg identify |
|
131 | 131 | b9154636be93 tip |
|
132 | 132 | $ hg blackbox -l 5 |
|
133 | 133 | 1970/01/01 00:00:00 bob> identify |
|
134 | 134 | 1970/01/01 00:00:00 bob> writing 48 bytes to cache/hgtagsfnodes1 |
|
135 | 135 | 1970/01/01 00:00:00 bob> 0/1 cache hits/lookups in * seconds (glob) |
|
136 | 136 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
137 | 137 | 1970/01/01 00:00:00 bob> identify exited 0 after ?.?? seconds (glob) |
|
138 | 138 | |
|
139 | 139 | Failure to acquire lock results in no write |
|
140 | 140 | |
|
141 | 141 | $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1 |
|
142 | 142 | $ echo 'foo:1' > .hg/wlock |
|
143 | 143 | $ hg identify |
|
144 | 144 | b9154636be93 tip |
|
145 | 145 | $ hg blackbox -l 5 |
|
146 | 146 | 1970/01/01 00:00:00 bob> identify |
|
147 | 147 | 1970/01/01 00:00:00 bob> not writing .hg/cache/hgtagsfnodes1 because lock held |
|
148 | 148 | 1970/01/01 00:00:00 bob> 0/1 cache hits/lookups in * seconds (glob) |
|
149 | 149 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
150 | 150 | 1970/01/01 00:00:00 bob> identify exited 0 after * seconds (glob) |
|
151 | 151 | |
|
152 | 152 | $ fnodescacheexists |
|
153 | 153 | no fnodes cache |
|
154 | 154 | |
|
155 | 155 | $ rm .hg/wlock |
|
156 | 156 | |
|
157 | 157 | $ rm -f .hg/cache/tags2-visible .hg/cache/hgtagsfnodes1 |
|
158 | 158 | $ hg identify |
|
159 | 159 | b9154636be93 tip |
|
160 | 160 | |
|
161 | 161 | Create a branch: |
|
162 | 162 | |
|
163 | 163 | $ echo bb > a |
|
164 | 164 | $ hg status |
|
165 | 165 | M a |
|
166 | 166 | $ hg identify |
|
167 | 167 | b9154636be93+ tip |
|
168 | 168 | $ hg co first |
|
169 | 169 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
170 | 170 | $ hg id |
|
171 | 171 | acb14030fe0a+ first |
|
172 | 172 | $ hg -v id |
|
173 | 173 | acb14030fe0a+ first |
|
174 | 174 | $ hg status |
|
175 | 175 | M a |
|
176 | 176 | $ echo 1 > b |
|
177 | 177 | $ hg add b |
|
178 | 178 | $ hg commit -m "branch" |
|
179 | 179 | created new head |
|
180 | 180 | |
|
181 | 181 | Creating a new commit shouldn't append the .hgtags fnodes cache until |
|
182 | 182 | tags info is accessed |
|
183 | 183 | |
|
184 | 184 | $ f --size --hexdump .hg/cache/hgtagsfnodes1 |
|
185 | 185 | .hg/cache/hgtagsfnodes1: size=48 |
|
186 | 186 | 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
187 | 187 | 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...| |
|
188 | 188 | 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| |
|
189 | 189 | |
|
190 | 190 | $ hg id |
|
191 | 191 | c8edf04160c7 tip |
|
192 | 192 | |
|
193 | 193 | First 4 bytes of record 3 are changeset fragment |
|
194 | 194 | |
|
195 | 195 | $ f --size --hexdump .hg/cache/hgtagsfnodes1 |
|
196 | 196 | .hg/cache/hgtagsfnodes1: size=72 |
|
197 | 197 | 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
198 | 198 | 0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...| |
|
199 | 199 | 0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y| |
|
200 | 200 | 0030: c8 ed f0 41 00 00 00 00 00 00 00 00 00 00 00 00 |...A............| |
|
201 | 201 | 0040: 00 00 00 00 00 00 00 00 |........| |
|
202 | 202 | |
|
203 | 203 | Merge the two heads: |
|
204 | 204 | |
|
205 | 205 | $ hg merge 1 |
|
206 | 206 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
207 | 207 | (branch merge, don't forget to commit) |
|
208 | 208 | $ hg id |
|
209 | 209 | c8edf04160c7+b9154636be93+ tip |
|
210 | 210 | $ hg status |
|
211 | 211 | M .hgtags |
|
212 | 212 | $ hg commit -m "merge" |
|
213 | 213 | |
|
214 | 214 | Create a fake head, make sure tag not visible afterwards: |
|
215 | 215 | |
|
216 | 216 | $ cp .hgtags tags |
|
217 | 217 | $ hg tag last |
|
218 | 218 | $ hg rm .hgtags |
|
219 | 219 | $ hg commit -m "remove" |
|
220 | 220 | |
|
221 | 221 | $ mv tags .hgtags |
|
222 | 222 | $ hg add .hgtags |
|
223 | 223 | $ hg commit -m "readd" |
|
224 | 224 | $ |
|
225 | 225 | $ hg tags |
|
226 | 226 | tip 6:35ff301afafe |
|
227 | 227 | first 0:acb14030fe0a |
|
228 | 228 | |
|
229 | 229 | Add invalid tags: |
|
230 | 230 | |
|
231 | 231 | $ echo "spam" >> .hgtags |
|
232 | 232 | $ echo >> .hgtags |
|
233 | 233 | $ echo "foo bar" >> .hgtags |
|
234 | 234 | $ echo "a5a5 invalid" >> .hg/localtags |
|
235 | 235 | $ cat .hgtags |
|
236 | 236 | acb14030fe0a21b60322c440ad2d20cf7685a376 first |
|
237 | 237 | spam |
|
238 | 238 | |
|
239 | 239 | foo bar |
|
240 | 240 | $ hg commit -m "tags" |
|
241 | 241 | |
|
242 | 242 | Report tag parse error on other head: |
|
243 | 243 | |
|
244 | 244 | $ hg up 3 |
|
245 | 245 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
246 | 246 | $ echo 'x y' >> .hgtags |
|
247 | 247 | $ hg commit -m "head" |
|
248 | 248 | created new head |
|
249 | 249 | |
|
250 | 250 | $ hg tags |
|
251 | 251 | .hgtags@75d9f02dfe28, line 2: cannot parse entry |
|
252 | 252 | .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed |
|
253 | 253 | .hgtags@c4be69a18c11, line 2: node 'x' is not well formed |
|
254 | 254 | tip 8:c4be69a18c11 |
|
255 | 255 | first 0:acb14030fe0a |
|
256 | 256 | $ hg tip |
|
257 | 257 | changeset: 8:c4be69a18c11 |
|
258 | 258 | tag: tip |
|
259 | 259 | parent: 3:ac5e980c4dc0 |
|
260 | 260 | user: test |
|
261 | 261 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
262 | 262 | summary: head |
|
263 | 263 | |
|
264 | 264 | |
|
265 | 265 | Test tag precedence rules: |
|
266 | 266 | |
|
267 | 267 | $ cd .. |
|
268 | 268 | $ hg init t2 |
|
269 | 269 | $ cd t2 |
|
270 | 270 | $ echo foo > foo |
|
271 | 271 | $ hg add foo |
|
272 | 272 | $ hg ci -m 'add foo' # rev 0 |
|
273 | 273 | $ hg tag bar # rev 1 |
|
274 | 274 | $ echo >> foo |
|
275 | 275 | $ hg ci -m 'change foo 1' # rev 2 |
|
276 | 276 | $ hg up -C 1 |
|
277 | 277 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
278 | 278 | $ hg tag -r 1 -f bar # rev 3 |
|
279 | 279 | $ hg up -C 1 |
|
280 | 280 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
281 | 281 | $ echo >> foo |
|
282 | 282 | $ hg ci -m 'change foo 2' # rev 4 |
|
283 | 283 | created new head |
|
284 | 284 | $ hg tags |
|
285 | 285 | tip 4:0c192d7d5e6b |
|
286 | 286 | bar 1:78391a272241 |
|
287 | 287 | |
|
288 | 288 | Repeat in case of cache effects: |
|
289 | 289 | |
|
290 | 290 | $ hg tags |
|
291 | 291 | tip 4:0c192d7d5e6b |
|
292 | 292 | bar 1:78391a272241 |
|
293 | 293 | |
|
294 | 294 | Detailed dump of tag info: |
|
295 | 295 | |
|
296 | 296 | $ hg heads -q # expect 4, 3, 2 |
|
297 | 297 | 4:0c192d7d5e6b |
|
298 | 298 | 3:6fa450212aeb |
|
299 | 299 | 2:7a94127795a3 |
|
300 | 300 | $ dumptags 2 |
|
301 | 301 | rev 2: .hgtags: |
|
302 | 302 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
303 | 303 | $ dumptags 3 |
|
304 | 304 | rev 3: .hgtags: |
|
305 | 305 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
306 | 306 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
307 | 307 | 78391a272241d70354aa14c874552cad6b51bb42 bar |
|
308 | 308 | $ dumptags 4 |
|
309 | 309 | rev 4: .hgtags: |
|
310 | 310 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
311 | 311 | |
|
312 | 312 | Dump cache: |
|
313 | 313 | |
|
314 | 314 | $ cat .hg/cache/tags2-visible |
|
315 | 315 | 4 0c192d7d5e6b78a714de54a2e9627952a877e25a |
|
316 | 316 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
317 | 317 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
318 | 318 | 78391a272241d70354aa14c874552cad6b51bb42 bar |
|
319 | 319 | |
|
320 | 320 | $ f --size --hexdump .hg/cache/hgtagsfnodes1 |
|
321 | 321 | .hg/cache/hgtagsfnodes1: size=120 |
|
322 | 322 | 0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
323 | 323 | 0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
324 | 324 | 0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| |
|
325 | 325 | 0030: 7a 94 12 77 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |z..w.....1....B(| |
|
326 | 326 | 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.| |
|
327 | 327 | 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..| |
|
328 | 328 | 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(| |
|
329 | 329 | 0070: 78 ee 5a 2d ad bc 94 3d |x.Z-...=| |
|
330 | 330 | |
|
331 | 331 | Corrupt the .hgtags fnodes cache |
|
332 | 332 | Extra junk data at the end should get overwritten on next cache update |
|
333 | 333 | |
|
334 | 334 | $ echo extra >> .hg/cache/hgtagsfnodes1 |
|
335 | 335 | $ echo dummy1 > foo |
|
336 | 336 | $ hg commit -m throwaway1 |
|
337 | 337 | |
|
338 | 338 | $ hg tags |
|
339 | 339 | tip 5:8dbfe60eff30 |
|
340 | 340 | bar 1:78391a272241 |
|
341 | 341 | |
|
342 | 342 | $ hg blackbox -l 5 |
|
343 | 343 | 1970/01/01 00:00:00 bob> tags |
|
344 | 344 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 |
|
345 | 345 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) |
|
346 | 346 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
347 | 347 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
348 | 348 | |
|
349 | 349 | #if unix-permissions no-root |
|
350 | 350 | Errors writing to .hgtags fnodes cache are silently ignored |
|
351 | 351 | |
|
352 | 352 | $ echo dummy2 > foo |
|
353 | 353 | $ hg commit -m throwaway2 |
|
354 | 354 | |
|
355 | 355 | $ chmod a-w .hg/cache/hgtagsfnodes1 |
|
356 | 356 | $ rm -f .hg/cache/tags2-visible |
|
357 | 357 | |
|
358 | 358 | $ hg tags |
|
359 | 359 | tip 6:b968051b5cf3 |
|
360 | 360 | bar 1:78391a272241 |
|
361 | 361 | |
|
362 | 362 | $ hg blackbox -l 5 |
|
363 | 363 | 1970/01/01 00:00:00 bob> tags |
|
364 | 364 | 1970/01/01 00:00:00 bob> couldn't write cache/hgtagsfnodes1: [Errno 13] Permission denied: '$TESTTMP/t2/.hg/cache/hgtagsfnodes1' |
|
365 | 365 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) |
|
366 | 366 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
367 | 367 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
368 | 368 | |
|
369 | 369 | $ chmod a+w .hg/cache/hgtagsfnodes1 |
|
370 | 370 | |
|
371 | 371 | $ rm -f .hg/cache/tags2-visible |
|
372 | 372 | $ hg tags |
|
373 | 373 | tip 6:b968051b5cf3 |
|
374 | 374 | bar 1:78391a272241 |
|
375 | 375 | |
|
376 | 376 | $ hg blackbox -l 5 |
|
377 | 377 | 1970/01/01 00:00:00 bob> tags |
|
378 | 378 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 |
|
379 | 379 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) |
|
380 | 380 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
381 | 381 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
382 | 382 | |
|
383 | 383 | $ f --size .hg/cache/hgtagsfnodes1 |
|
384 | 384 | .hg/cache/hgtagsfnodes1: size=168 |
|
385 | 385 | |
|
386 | 386 | $ hg -q --config extensions.strip= strip -r 6 --no-backup |
|
387 | 387 | #endif |
|
388 | 388 | |
|
389 | 389 | Stripping doesn't truncate the tags cache until new data is available |
|
390 | 390 | |
|
391 | 391 | $ rm -f .hg/cache/hgtagsfnodes1 .hg/cache/tags2-visible |
|
392 |
$ hg tags |
|
|
392 | $ hg tags | |
|
393 | 393 | tip 5:8dbfe60eff30 |
|
394 | 394 | bar 1:78391a272241 |
|
395 | 395 | |
|
396 | 396 | $ f --size .hg/cache/hgtagsfnodes1 |
|
397 | 397 | .hg/cache/hgtagsfnodes1: size=144 |
|
398 | 398 | |
|
399 | 399 | $ hg -q --config extensions.strip= strip -r 5 --no-backup |
|
400 | 400 | $ hg tags |
|
401 | 401 | tip 4:0c192d7d5e6b |
|
402 | 402 | bar 1:78391a272241 |
|
403 | 403 | |
|
404 | 404 | $ hg blackbox -l 4 |
|
405 | 405 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 |
|
406 | 406 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) |
|
407 | 407 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
408 | 408 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
409 | 409 | |
|
410 | 410 | $ f --size .hg/cache/hgtagsfnodes1 |
|
411 | 411 | .hg/cache/hgtagsfnodes1: size=120 |
|
412 | 412 | |
|
413 | 413 | $ echo dummy > foo |
|
414 | 414 | $ hg commit -m throwaway3 |
|
415 | 415 | |
|
416 | 416 | $ hg tags |
|
417 | 417 | tip 5:035f65efb448 |
|
418 | 418 | bar 1:78391a272241 |
|
419 | 419 | |
|
420 | 420 | $ hg blackbox -l 5 |
|
421 | 421 | 1970/01/01 00:00:00 bob> tags |
|
422 | 422 | 1970/01/01 00:00:00 bob> writing 24 bytes to cache/hgtagsfnodes1 |
|
423 | 423 | 1970/01/01 00:00:00 bob> 2/3 cache hits/lookups in * seconds (glob) |
|
424 | 424 | 1970/01/01 00:00:00 bob> writing .hg/cache/tags2-visible with 1 tags |
|
425 | 425 | 1970/01/01 00:00:00 bob> tags exited 0 after * seconds (glob) |
|
426 | 426 | $ f --size .hg/cache/hgtagsfnodes1 |
|
427 | 427 | .hg/cache/hgtagsfnodes1: size=144 |
|
428 | 428 | |
|
429 | 429 | $ hg -q --config extensions.strip= strip -r 5 --no-backup |
|
430 | 430 | |
|
431 | 431 | Test tag removal: |
|
432 | 432 | |
|
433 | 433 | $ hg tag --remove bar # rev 5 |
|
434 | 434 | $ hg tip -vp |
|
435 | 435 | changeset: 5:5f6e8655b1c7 |
|
436 | 436 | tag: tip |
|
437 | 437 | user: test |
|
438 | 438 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
439 | 439 | files: .hgtags |
|
440 | 440 | description: |
|
441 | 441 | Removed tag bar |
|
442 | 442 | |
|
443 | 443 | |
|
444 | 444 | diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags |
|
445 | 445 | --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
446 | 446 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
447 | 447 | @@ -1,1 +1,3 @@ |
|
448 | 448 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
449 | 449 | +78391a272241d70354aa14c874552cad6b51bb42 bar |
|
450 | 450 | +0000000000000000000000000000000000000000 bar |
|
451 | 451 | |
|
452 | 452 | $ hg tags |
|
453 | 453 | tip 5:5f6e8655b1c7 |
|
454 | 454 | $ hg tags # again, try to expose cache bugs |
|
455 | 455 | tip 5:5f6e8655b1c7 |
|
456 | 456 | |
|
457 | 457 | Remove nonexistent tag: |
|
458 | 458 | |
|
459 | 459 | $ hg tag --remove foobar |
|
460 | 460 | abort: tag 'foobar' does not exist |
|
461 | 461 | [255] |
|
462 | 462 | $ hg tip |
|
463 | 463 | changeset: 5:5f6e8655b1c7 |
|
464 | 464 | tag: tip |
|
465 | 465 | user: test |
|
466 | 466 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
467 | 467 | summary: Removed tag bar |
|
468 | 468 | |
|
469 | 469 | |
|
470 | 470 | Undo a tag with rollback: |
|
471 | 471 | |
|
472 | 472 | $ hg rollback # destroy rev 5 (restore bar) |
|
473 | 473 | repository tip rolled back to revision 4 (undo commit) |
|
474 | 474 | working directory now based on revision 4 |
|
475 | 475 | $ hg tags |
|
476 | 476 | tip 4:0c192d7d5e6b |
|
477 | 477 | bar 1:78391a272241 |
|
478 | 478 | $ hg tags |
|
479 | 479 | tip 4:0c192d7d5e6b |
|
480 | 480 | bar 1:78391a272241 |
|
481 | 481 | |
|
482 | 482 | Test tag rank: |
|
483 | 483 | |
|
484 | 484 | $ cd .. |
|
485 | 485 | $ hg init t3 |
|
486 | 486 | $ cd t3 |
|
487 | 487 | $ echo foo > foo |
|
488 | 488 | $ hg add foo |
|
489 | 489 | $ hg ci -m 'add foo' # rev 0 |
|
490 | 490 | $ hg tag -f bar # rev 1 bar -> 0 |
|
491 | 491 | $ hg tag -f bar # rev 2 bar -> 1 |
|
492 | 492 | $ hg tag -fr 0 bar # rev 3 bar -> 0 |
|
493 | 493 | $ hg tag -fr 1 bar # rev 4 bar -> 1 |
|
494 | 494 | $ hg tag -fr 0 bar # rev 5 bar -> 0 |
|
495 | 495 | $ hg tags |
|
496 | 496 | tip 5:85f05169d91d |
|
497 | 497 | bar 0:bbd179dfa0a7 |
|
498 | 498 | $ hg co 3 |
|
499 | 499 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
500 | 500 | $ echo barbar > foo |
|
501 | 501 | $ hg ci -m 'change foo' # rev 6 |
|
502 | 502 | created new head |
|
503 | 503 | $ hg tags |
|
504 | 504 | tip 6:735c3ca72986 |
|
505 | 505 | bar 0:bbd179dfa0a7 |
|
506 | 506 | |
|
507 | 507 | Don't allow moving tag without -f: |
|
508 | 508 | |
|
509 | 509 | $ hg tag -r 3 bar |
|
510 | 510 | abort: tag 'bar' already exists (use -f to force) |
|
511 | 511 | [255] |
|
512 | 512 | $ hg tags |
|
513 | 513 | tip 6:735c3ca72986 |
|
514 | 514 | bar 0:bbd179dfa0a7 |
|
515 | 515 | |
|
516 | 516 | Strip 1: expose an old head: |
|
517 | 517 | |
|
518 | 518 | $ hg --config extensions.mq= strip 5 |
|
519 | 519 | saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) |
|
520 | 520 | $ hg tags # partly stale cache |
|
521 | 521 | tip 5:735c3ca72986 |
|
522 | 522 | bar 1:78391a272241 |
|
523 | 523 | $ hg tags # up-to-date cache |
|
524 | 524 | tip 5:735c3ca72986 |
|
525 | 525 | bar 1:78391a272241 |
|
526 | 526 | |
|
527 | 527 | Strip 2: destroy whole branch, no old head exposed |
|
528 | 528 | |
|
529 | 529 | $ hg --config extensions.mq= strip 4 |
|
530 | 530 | saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) |
|
531 | 531 | $ hg tags # partly stale |
|
532 | 532 | tip 4:735c3ca72986 |
|
533 | 533 | bar 0:bbd179dfa0a7 |
|
534 | 534 | $ rm -f .hg/cache/tags2-visible |
|
535 | 535 | $ hg tags # cold cache |
|
536 | 536 | tip 4:735c3ca72986 |
|
537 | 537 | bar 0:bbd179dfa0a7 |
|
538 | 538 | |
|
539 | 539 | Test tag rank with 3 heads: |
|
540 | 540 | |
|
541 | 541 | $ cd .. |
|
542 | 542 | $ hg init t4 |
|
543 | 543 | $ cd t4 |
|
544 | 544 | $ echo foo > foo |
|
545 | 545 | $ hg add |
|
546 | 546 | adding foo |
|
547 | 547 | $ hg ci -m 'add foo' # rev 0 |
|
548 | 548 | $ hg tag bar # rev 1 bar -> 0 |
|
549 | 549 | $ hg tag -f bar # rev 2 bar -> 1 |
|
550 | 550 | $ hg up -qC 0 |
|
551 | 551 | $ hg tag -fr 2 bar # rev 3 bar -> 2 |
|
552 | 552 | $ hg tags |
|
553 | 553 | tip 3:197c21bbbf2c |
|
554 | 554 | bar 2:6fa450212aeb |
|
555 | 555 | $ hg up -qC 0 |
|
556 | 556 | $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 |
|
557 | 557 | |
|
558 | 558 | Bar should still point to rev 2: |
|
559 | 559 | |
|
560 | 560 | $ hg tags |
|
561 | 561 | tip 4:3b4b14ed0202 |
|
562 | 562 | bar 2:6fa450212aeb |
|
563 | 563 | |
|
564 | 564 | Test that removing global/local tags does not get confused when trying |
|
565 | 565 | to remove a tag of type X which actually only exists as a type Y: |
|
566 | 566 | |
|
567 | 567 | $ cd .. |
|
568 | 568 | $ hg init t5 |
|
569 | 569 | $ cd t5 |
|
570 | 570 | $ echo foo > foo |
|
571 | 571 | $ hg add |
|
572 | 572 | adding foo |
|
573 | 573 | $ hg ci -m 'add foo' # rev 0 |
|
574 | 574 | |
|
575 | 575 | $ hg tag -r 0 -l localtag |
|
576 | 576 | $ hg tag --remove localtag |
|
577 | 577 | abort: tag 'localtag' is not a global tag |
|
578 | 578 | [255] |
|
579 | 579 | $ |
|
580 | 580 | $ hg tag -r 0 globaltag |
|
581 | 581 | $ hg tag --remove -l globaltag |
|
582 | 582 | abort: tag 'globaltag' is not a local tag |
|
583 | 583 | [255] |
|
584 | 584 | $ hg tags -v |
|
585 | 585 | tip 1:a0b6fe111088 |
|
586 | 586 | localtag 0:bbd179dfa0a7 local |
|
587 | 587 | globaltag 0:bbd179dfa0a7 |
|
588 | 588 | |
|
589 | 589 | Test for issue3911 |
|
590 | 590 | |
|
591 | 591 | $ hg tag -r 0 -l localtag2 |
|
592 | 592 | $ hg tag -l --remove localtag2 |
|
593 | 593 | $ hg tags -v |
|
594 | 594 | tip 1:a0b6fe111088 |
|
595 | 595 | localtag 0:bbd179dfa0a7 local |
|
596 | 596 | globaltag 0:bbd179dfa0a7 |
|
597 | 597 | |
|
598 | 598 | $ hg tag -r 1 -f localtag |
|
599 | 599 | $ hg tags -v |
|
600 | 600 | tip 2:5c70a037bb37 |
|
601 | 601 | localtag 1:a0b6fe111088 |
|
602 | 602 | globaltag 0:bbd179dfa0a7 |
|
603 | 603 | |
|
604 | 604 | $ hg tags -v |
|
605 | 605 | tip 2:5c70a037bb37 |
|
606 | 606 | localtag 1:a0b6fe111088 |
|
607 | 607 | globaltag 0:bbd179dfa0a7 |
|
608 | 608 | |
|
609 | 609 | $ hg tag -r 1 localtag2 |
|
610 | 610 | $ hg tags -v |
|
611 | 611 | tip 3:bbfb8cd42be2 |
|
612 | 612 | localtag2 1:a0b6fe111088 |
|
613 | 613 | localtag 1:a0b6fe111088 |
|
614 | 614 | globaltag 0:bbd179dfa0a7 |
|
615 | 615 | |
|
616 | 616 | $ hg tags -v |
|
617 | 617 | tip 3:bbfb8cd42be2 |
|
618 | 618 | localtag2 1:a0b6fe111088 |
|
619 | 619 | localtag 1:a0b6fe111088 |
|
620 | 620 | globaltag 0:bbd179dfa0a7 |
|
621 | 621 | |
|
622 | 622 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now