##// END OF EJS Templates
tests: rework revision branch cache tests...
Mads Kiilerich -
r23861:01426cad default
parent child Browse files
Show More
@@ -1,598 +1,623
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo 'root' >root
4 4 $ hg add root
5 5 $ hg commit -d '0 0' -m "Adding root node"
6 6
7 7 $ echo 'a' >a
8 8 $ hg add a
9 9 $ hg branch a
10 10 marked working directory as branch a
11 11 (branches are permanent and global, did you want a bookmark?)
12 12 $ hg commit -d '1 0' -m "Adding a branch"
13 13
14 14 $ hg branch q
15 15 marked working directory as branch q
16 16 (branches are permanent and global, did you want a bookmark?)
17 17 $ echo 'aa' >a
18 18 $ hg branch -C
19 19 reset working directory to branch a
20 20 $ hg commit -d '2 0' -m "Adding to a branch"
21 21
22 22 $ hg update -C 0
23 23 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 24 $ echo 'b' >b
25 25 $ hg add b
26 26 $ hg branch b
27 27 marked working directory as branch b
28 28 (branches are permanent and global, did you want a bookmark?)
29 29 $ hg commit -d '2 0' -m "Adding b branch"
30 30
31 31 $ echo 'bh1' >bh1
32 32 $ hg add bh1
33 33 $ hg commit -d '3 0' -m "Adding b branch head 1"
34 34
35 35 $ hg update -C 2
36 36 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
37 37 $ echo 'bh2' >bh2
38 38 $ hg add bh2
39 39 $ hg commit -d '4 0' -m "Adding b branch head 2"
40 40
41 41 $ echo 'c' >c
42 42 $ hg add c
43 43 $ hg branch c
44 44 marked working directory as branch c
45 45 (branches are permanent and global, did you want a bookmark?)
46 46 $ hg commit -d '5 0' -m "Adding c branch"
47 47
48 48 reserved names
49 49
50 50 $ hg branch tip
51 51 abort: the name 'tip' is reserved
52 52 [255]
53 53 $ hg branch null
54 54 abort: the name 'null' is reserved
55 55 [255]
56 56 $ hg branch .
57 57 abort: the name '.' is reserved
58 58 [255]
59 59
60 60 invalid characters
61 61
62 62 $ hg branch 'foo:bar'
63 63 abort: ':' cannot be used in a name
64 64 [255]
65 65
66 66 $ hg branch 'foo
67 67 > bar'
68 68 abort: '\n' cannot be used in a name
69 69 [255]
70 70
71 71 trailing or leading spaces should be stripped before testing duplicates
72 72
73 73 $ hg branch 'b '
74 74 abort: a branch of the same name already exists
75 75 (use 'hg update' to switch to it)
76 76 [255]
77 77
78 78 $ hg branch ' b'
79 79 abort: a branch of the same name already exists
80 80 (use 'hg update' to switch to it)
81 81 [255]
82 82
83 83 verify update will accept invalid legacy branch names
84 84
85 85 $ hg init test-invalid-branch-name
86 86 $ cd test-invalid-branch-name
87 87 $ hg pull -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
88 88 pulling from *test-invalid-branch-name.hg (glob)
89 89 requesting all changes
90 90 adding changesets
91 91 adding manifests
92 92 adding file changes
93 93 added 3 changesets with 3 changes to 2 files
94 94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 95
96 96 $ hg update '"colon:test"'
97 97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 98 $ cd ..
99 99
100 100 $ echo 'd' >d
101 101 $ hg add d
102 102 $ hg branch 'a branch name much longer than the default justification used by branches'
103 103 marked working directory as branch a branch name much longer than the default justification used by branches
104 104 (branches are permanent and global, did you want a bookmark?)
105 105 $ hg commit -d '6 0' -m "Adding d branch"
106 106
107 107 $ hg branches
108 108 a branch name much longer than the default justification used by branches 7:10ff5895aa57
109 109 b 4:aee39cd168d0
110 110 c 6:589736a22561 (inactive)
111 111 a 5:d8cbc61dbaa6 (inactive)
112 112 default 0:19709c5a4e75 (inactive)
113 113
114 114 -------
115 115
116 116 $ hg branches -a
117 117 a branch name much longer than the default justification used by branches 7:10ff5895aa57
118 118 b 4:aee39cd168d0
119 119
120 120 --- Branch a
121 121
122 122 $ hg log -b a
123 123 changeset: 5:d8cbc61dbaa6
124 124 branch: a
125 125 parent: 2:881fe2b92ad0
126 126 user: test
127 127 date: Thu Jan 01 00:00:04 1970 +0000
128 128 summary: Adding b branch head 2
129 129
130 130 changeset: 2:881fe2b92ad0
131 131 branch: a
132 132 user: test
133 133 date: Thu Jan 01 00:00:02 1970 +0000
134 134 summary: Adding to a branch
135 135
136 136 changeset: 1:dd6b440dd85a
137 137 branch: a
138 138 user: test
139 139 date: Thu Jan 01 00:00:01 1970 +0000
140 140 summary: Adding a branch
141 141
142 142
143 143 ---- Branch b
144 144
145 145 $ hg log -b b
146 146 changeset: 4:aee39cd168d0
147 147 branch: b
148 148 user: test
149 149 date: Thu Jan 01 00:00:03 1970 +0000
150 150 summary: Adding b branch head 1
151 151
152 152 changeset: 3:ac22033332d1
153 153 branch: b
154 154 parent: 0:19709c5a4e75
155 155 user: test
156 156 date: Thu Jan 01 00:00:02 1970 +0000
157 157 summary: Adding b branch
158 158
159 159
160 160 ---- going to test branch closing
161 161
162 162 $ hg branches
163 163 a branch name much longer than the default justification used by branches 7:10ff5895aa57
164 164 b 4:aee39cd168d0
165 165 c 6:589736a22561 (inactive)
166 166 a 5:d8cbc61dbaa6 (inactive)
167 167 default 0:19709c5a4e75 (inactive)
168 168 $ hg up -C b
169 169 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
170 170 $ echo 'xxx1' >> b
171 171 $ hg commit -d '7 0' -m 'adding cset to branch b'
172 172 $ hg up -C aee39cd168d0
173 173 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 174 $ echo 'xxx2' >> b
175 175 $ hg commit -d '8 0' -m 'adding head to branch b'
176 176 created new head
177 177 $ echo 'xxx3' >> b
178 178 $ hg commit -d '9 0' -m 'adding another cset to branch b'
179 179 $ hg branches
180 180 b 10:bfbe841b666e
181 181 a branch name much longer than the default justification used by branches 7:10ff5895aa57
182 182 c 6:589736a22561 (inactive)
183 183 a 5:d8cbc61dbaa6 (inactive)
184 184 default 0:19709c5a4e75 (inactive)
185 185 $ hg heads --closed
186 186 changeset: 10:bfbe841b666e
187 187 branch: b
188 188 tag: tip
189 189 user: test
190 190 date: Thu Jan 01 00:00:09 1970 +0000
191 191 summary: adding another cset to branch b
192 192
193 193 changeset: 8:eebb944467c9
194 194 branch: b
195 195 parent: 4:aee39cd168d0
196 196 user: test
197 197 date: Thu Jan 01 00:00:07 1970 +0000
198 198 summary: adding cset to branch b
199 199
200 200 changeset: 7:10ff5895aa57
201 201 branch: a branch name much longer than the default justification used by branches
202 202 user: test
203 203 date: Thu Jan 01 00:00:06 1970 +0000
204 204 summary: Adding d branch
205 205
206 206 changeset: 6:589736a22561
207 207 branch: c
208 208 user: test
209 209 date: Thu Jan 01 00:00:05 1970 +0000
210 210 summary: Adding c branch
211 211
212 212 changeset: 5:d8cbc61dbaa6
213 213 branch: a
214 214 parent: 2:881fe2b92ad0
215 215 user: test
216 216 date: Thu Jan 01 00:00:04 1970 +0000
217 217 summary: Adding b branch head 2
218 218
219 219 changeset: 0:19709c5a4e75
220 220 user: test
221 221 date: Thu Jan 01 00:00:00 1970 +0000
222 222 summary: Adding root node
223 223
224 224 $ hg heads
225 225 changeset: 10:bfbe841b666e
226 226 branch: b
227 227 tag: tip
228 228 user: test
229 229 date: Thu Jan 01 00:00:09 1970 +0000
230 230 summary: adding another cset to branch b
231 231
232 232 changeset: 8:eebb944467c9
233 233 branch: b
234 234 parent: 4:aee39cd168d0
235 235 user: test
236 236 date: Thu Jan 01 00:00:07 1970 +0000
237 237 summary: adding cset to branch b
238 238
239 239 changeset: 7:10ff5895aa57
240 240 branch: a branch name much longer than the default justification used by branches
241 241 user: test
242 242 date: Thu Jan 01 00:00:06 1970 +0000
243 243 summary: Adding d branch
244 244
245 245 changeset: 6:589736a22561
246 246 branch: c
247 247 user: test
248 248 date: Thu Jan 01 00:00:05 1970 +0000
249 249 summary: Adding c branch
250 250
251 251 changeset: 5:d8cbc61dbaa6
252 252 branch: a
253 253 parent: 2:881fe2b92ad0
254 254 user: test
255 255 date: Thu Jan 01 00:00:04 1970 +0000
256 256 summary: Adding b branch head 2
257 257
258 258 changeset: 0:19709c5a4e75
259 259 user: test
260 260 date: Thu Jan 01 00:00:00 1970 +0000
261 261 summary: Adding root node
262 262
263 263 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
264 264 $ hg branches -a
265 265 b 8:eebb944467c9
266 266 a branch name much longer than the default justification used by branches 7:10ff5895aa57
267 267 $ hg up -C b
268 268 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 269 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
270 270 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
271 271 abort: can only close branch heads
272 272 [255]
273 273
274 274 $ hg log -r tip --debug
275 275 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
276 276 branch: b
277 277 tag: tip
278 278 phase: draft
279 279 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
280 280 parent: -1:0000000000000000000000000000000000000000
281 281 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
282 282 user: test
283 283 date: Thu Jan 01 00:00:09 1970 +0000
284 284 extra: branch=b
285 285 extra: close=1
286 286 description:
287 287 close this part branch too
288 288
289 289
290 290 --- b branch should be inactive
291 291
292 292 $ hg branches
293 293 a branch name much longer than the default justification used by branches 7:10ff5895aa57
294 294 c 6:589736a22561 (inactive)
295 295 a 5:d8cbc61dbaa6 (inactive)
296 296 default 0:19709c5a4e75 (inactive)
297 297 $ hg branches -c
298 298 a branch name much longer than the default justification used by branches 7:10ff5895aa57
299 299 b 12:e3d49c0575d8 (closed)
300 300 c 6:589736a22561 (inactive)
301 301 a 5:d8cbc61dbaa6 (inactive)
302 302 default 0:19709c5a4e75 (inactive)
303 303 $ hg branches -a
304 304 a branch name much longer than the default justification used by branches 7:10ff5895aa57
305 305 $ hg branches -q
306 306 a branch name much longer than the default justification used by branches
307 307 c
308 308 a
309 309 default
310 310 $ hg heads b
311 311 no open branch heads found on branches b
312 312 [1]
313 313 $ hg heads --closed b
314 314 changeset: 12:e3d49c0575d8
315 315 branch: b
316 316 tag: tip
317 317 parent: 8:eebb944467c9
318 318 user: test
319 319 date: Thu Jan 01 00:00:09 1970 +0000
320 320 summary: close this part branch too
321 321
322 322 changeset: 11:d3f163457ebf
323 323 branch: b
324 324 user: test
325 325 date: Thu Jan 01 00:00:09 1970 +0000
326 326 summary: prune bad branch
327 327
328 328 $ echo 'xxx4' >> b
329 329 $ hg commit -d '9 0' -m 'reopen branch with a change'
330 330 reopening closed branch head 12
331 331
332 332 --- branch b is back in action
333 333
334 334 $ hg branches -a
335 335 b 13:e23b5505d1ad
336 336 a branch name much longer than the default justification used by branches 7:10ff5895aa57
337 337
338 338 ---- test heads listings
339 339
340 340 $ hg heads
341 341 changeset: 13:e23b5505d1ad
342 342 branch: b
343 343 tag: tip
344 344 user: test
345 345 date: Thu Jan 01 00:00:09 1970 +0000
346 346 summary: reopen branch with a change
347 347
348 348 changeset: 7:10ff5895aa57
349 349 branch: a branch name much longer than the default justification used by branches
350 350 user: test
351 351 date: Thu Jan 01 00:00:06 1970 +0000
352 352 summary: Adding d branch
353 353
354 354 changeset: 6:589736a22561
355 355 branch: c
356 356 user: test
357 357 date: Thu Jan 01 00:00:05 1970 +0000
358 358 summary: Adding c branch
359 359
360 360 changeset: 5:d8cbc61dbaa6
361 361 branch: a
362 362 parent: 2:881fe2b92ad0
363 363 user: test
364 364 date: Thu Jan 01 00:00:04 1970 +0000
365 365 summary: Adding b branch head 2
366 366
367 367 changeset: 0:19709c5a4e75
368 368 user: test
369 369 date: Thu Jan 01 00:00:00 1970 +0000
370 370 summary: Adding root node
371 371
372 372
373 373 branch default
374 374
375 375 $ hg heads default
376 376 changeset: 0:19709c5a4e75
377 377 user: test
378 378 date: Thu Jan 01 00:00:00 1970 +0000
379 379 summary: Adding root node
380 380
381 381
382 382 branch a
383 383
384 384 $ hg heads a
385 385 changeset: 5:d8cbc61dbaa6
386 386 branch: a
387 387 parent: 2:881fe2b92ad0
388 388 user: test
389 389 date: Thu Jan 01 00:00:04 1970 +0000
390 390 summary: Adding b branch head 2
391 391
392 392 $ hg heads --active a
393 393 no open branch heads found on branches a
394 394 [1]
395 395
396 396 branch b
397 397
398 398 $ hg heads b
399 399 changeset: 13:e23b5505d1ad
400 400 branch: b
401 401 tag: tip
402 402 user: test
403 403 date: Thu Jan 01 00:00:09 1970 +0000
404 404 summary: reopen branch with a change
405 405
406 406 $ hg heads --closed b
407 407 changeset: 13:e23b5505d1ad
408 408 branch: b
409 409 tag: tip
410 410 user: test
411 411 date: Thu Jan 01 00:00:09 1970 +0000
412 412 summary: reopen branch with a change
413 413
414 414 changeset: 11:d3f163457ebf
415 415 branch: b
416 416 user: test
417 417 date: Thu Jan 01 00:00:09 1970 +0000
418 418 summary: prune bad branch
419 419
420 420 default branch colors:
421 421
422 422 $ cat <<EOF >> $HGRCPATH
423 423 > [extensions]
424 424 > color =
425 425 > [color]
426 426 > mode = ansi
427 427 > EOF
428 428
429 429 $ hg up -C c
430 430 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
431 431 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
432 432 $ hg up -C b
433 433 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
434 434 $ hg branches --color=always
435 435 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
436 436 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
437 437 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
438 438 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
439 439
440 440 default closed branch color:
441 441
442 442 $ hg branches --color=always --closed
443 443 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
444 444 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
445 445 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
446 446 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
447 447 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
448 448
449 449 $ cat <<EOF >> $HGRCPATH
450 450 > [extensions]
451 451 > color =
452 452 > [color]
453 453 > branches.active = green
454 454 > branches.closed = blue
455 455 > branches.current = red
456 456 > branches.inactive = magenta
457 457 > log.changeset = cyan
458 458 > EOF
459 459
460 460 custom branch colors:
461 461
462 462 $ hg branches --color=always
463 463 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
464 464 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
465 465 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
466 466 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
467 467
468 468 custom closed branch color:
469 469
470 470 $ hg branches --color=always --closed
471 471 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
472 472 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
473 473 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
474 474 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
475 475 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
476 476
477 477 template output:
478 478
479 479 $ hg branches -Tjson --closed
480 480 [
481 481 {
482 482 "active": true,
483 483 "branch": "b",
484 484 "closed": false,
485 485 "current": true,
486 486 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
487 487 "rev": 13
488 488 },
489 489 {
490 490 "active": true,
491 491 "branch": "a branch name much longer than the default justification used by branches",
492 492 "closed": false,
493 493 "current": false,
494 494 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
495 495 "rev": 7
496 496 },
497 497 {
498 498 "active": false,
499 499 "branch": "c",
500 500 "closed": true,
501 501 "current": false,
502 502 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
503 503 "rev": 14
504 504 },
505 505 {
506 506 "active": false,
507 507 "branch": "a",
508 508 "closed": false,
509 509 "current": false,
510 510 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
511 511 "rev": 5
512 512 },
513 513 {
514 514 "active": false,
515 515 "branch": "default",
516 516 "closed": false,
517 517 "current": false,
518 518 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
519 519 "rev": 0
520 520 }
521 521 ]
522 522
523 revision branch name caching implementation
523
524 Tests of revision branch name caching
525
526 We rev branch cache is updated automatically. In these tests we use a trick to
527 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
528 rebuild that also will populate the rev branch cache.
524 529
525 cache creation
526 $ rm .hg/cache/rbc-revs-v1
527 $ hg debugrevspec 'branch("re:a ")'
528 7
529 $ [ -f .hg/cache/rbc-revs-v1 ] || echo no file
530 no file
531 recovery from invalid cache file
532 $ echo > .hg/cache/rbc-revs-v1
533 $ hg debugrevspec 'branch("re:a ")'
534 7
535 cache update NOT fully written from revset
536 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
537 68b329da9893e34099c7d8ad5cb9c940 .hg/cache/rbc-revs-v1
538 recovery from other corruption - extra trailing data
530 revision branch cache is created when building the branch head cache
531 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
532 5
533 $ f --hexdump --size .hg/cache/rbc-*
534 .hg/cache/rbc-names-v1: size=87
535 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
536 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
537 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
538 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
539 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
540 0050: 72 61 6e 63 68 65 73 |ranches|
541 .hg/cache/rbc-revs-v1: size=120
542 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
543 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
544 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
545 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
546 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
547 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
548 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
549 0070: f8 94 c2 56 80 00 00 03 |...V....|
550 recovery from invalid cache revs file with trailing data
539 551 $ echo >> .hg/cache/rbc-revs-v1
540 $ hg debugrevspec 'branch("re:a ")'
541 7
542 cache update NOT fully written from revset
543 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
544 e1c06d85ae7b8b032bef47e42e4c08f9 .hg/cache/rbc-revs-v1
545 lazy update after commit
546 $ hg tag tag
547 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
548 d0c0166808ee0a1f0e8894915ad363b6 .hg/cache/rbc-revs-v1
549 $ hg debugrevspec 'branch("re:a ")'
550 7
551 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
552 d0c0166808ee0a1f0e8894915ad363b6 .hg/cache/rbc-revs-v1
553 update after rollback - cache keeps stripped revs until written for other reasons
552 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
553 5
554 $ f --size .hg/cache/rbc-revs*
555 .hg/cache/rbc-revs-v1: size=120
556 recovery from invalid cache file with partial last record
557 $ mv .hg/cache/rbc-revs-v1 .
558 $ f -qDB 119 rbc-revs-v1 > .hg/cache/rbc-revs-v1
559 $ f --size .hg/cache/rbc-revs*
560 .hg/cache/rbc-revs-v1: size=119
561 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
562 5
563 $ f --size .hg/cache/rbc-revs*
564 .hg/cache/rbc-revs-v1: size=120
565 recovery from invalid cache file with missing record - no truncation
566 $ mv .hg/cache/rbc-revs-v1 .
567 $ f -qDB 112 rbc-revs-v1 > .hg/cache/rbc-revs-v1
568 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
569 5
570 $ f --size .hg/cache/rbc-revs*
571 .hg/cache/rbc-revs-v1: size=120
572 recovery from invalid cache file with some bad records
573 $ mv .hg/cache/rbc-revs-v1 .
574 $ f -qDB 8 rbc-revs-v1 > .hg/cache/rbc-revs-v1
575 $ f --size .hg/cache/rbc-revs*
576 .hg/cache/rbc-revs-v1: size=8
577 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
578 $ f --size .hg/cache/rbc-revs*
579 .hg/cache/rbc-revs-v1: size=120
580 $ hg log -r 'branch(.)' -T '{rev} '
581 3 4 8 9 10 11 12 13 (no-eol)
582 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
583 5
584 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
585 .hg/cache/rbc-revs-v1: size=120
586 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
587 cache is updated when committing
588 $ hg branch i-will-regret-this
589 marked working directory as branch i-will-regret-this
590 (branches are permanent and global, did you want a bookmark?)
591 $ hg ci -m regrets
592 $ f --size .hg/cache/rbc-*
593 .hg/cache/rbc-names-v1: size=106
594 .hg/cache/rbc-revs-v1: size=128
595 update after rollback - the cache will be correct but rbc-names will will still
596 contain the branch name even though it no longer is used
554 597 $ hg up -qr '.^'
555 598 $ hg rollback -qf
556 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
557 d8c2acdc229bf942fde1dfdbe8f9d933 .hg/cache/rbc-revs-v1
558 $ hg debugrevspec 'branch("re:a ")'
559 7
560 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
561 d8c2acdc229bf942fde1dfdbe8f9d933 .hg/cache/rbc-revs-v1
562 handle history mutations that doesn't change the tip node - this is a problem
563 with the cache invalidation scheme used by branchmap
564 $ hg log -r tip+b -T'{rev}:{node|short} {branch}\n'
565 14:f894c25619d3 c
566 13:e23b5505d1ad b
567 $ hg bundle -q --all bu.hg
568 $ hg --config extensions.strip= strip --no-b -qr -1:
569 $ hg up -q tip
570 $ hg branch
571 b
572 $ hg branch -q hacked
573 $ hg ci --amend -qm 'hacked'
574 $ hg pull -q bu.hg -r f894c25619d3
575 $ hg log -r tip+b -T'{rev}:{node|short} {branch}\n'
576 14:f894c25619d3 c
577 12:e3d49c0575d8 b
578 $ hg debugrevspec 'branch("hacked")'
579 13
580 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
581 22424d7e106c894336d9d705b0241bc5 .hg/cache/rbc-revs-v1
582 cleanup, restore old state
583 $ hg --config extensions.strip= strip --no-b -qr -2:
584 $ hg pull -q bu.hg
585 $ rm bu.hg
586 $ hg up -qr tip
587 $ hg log -r tip -T'{rev}:{node|short}\n'
588 14:f894c25619d3
589 the cache file do not go back to the old state - it still contains the
590 now unused 'hacked' branch name)
591 $ hg debugrevspec 'branch("re:a ")'
592 7
593 $ "$TESTDIR/md5sum.py" .hg/cache/rbc-revs-v1
594 d8c2acdc229bf942fde1dfdbe8f9d933 .hg/cache/rbc-revs-v1
595 $ cat .hg/cache/rbc-names-v1
596 default\x00a\x00b\x00c\x00a branch name much longer than the default justification used by branches\x00hacked (no-eol) (esc)
599 $ f --size --hexdump .hg/cache/rbc-*
600 .hg/cache/rbc-names-v1: size=106
601 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
602 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
603 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
604 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
605 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
606 0050: 72 61 6e 63 68 65 73 00 69 2d 77 69 6c 6c 2d 72 |ranches.i-will-r|
607 0060: 65 67 72 65 74 2d 74 68 69 73 |egret-this|
608 .hg/cache/rbc-revs-v1: size=120
609 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
610 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
611 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
612 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
613 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
614 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
615 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
616 0070: f8 94 c2 56 80 00 00 03 |...V....|
617 cache is updated/truncated when stripping - it is thus very hard to get in a
618 situation where the cache is out of sync and the hash check detects it
619 $ hg --config extensions.strip= strip -r tip --nob
620 $ f --size .hg/cache/rbc-revs*
621 .hg/cache/rbc-revs-v1: size=112
597 622
598 623 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now