Debian Codegraph @

tests/test-branches.t

raw
1 #testcases mmap nommap
2 #testcases v2 v3
3
4 $ . $TESTDIR/testlib/common.sh
5
6 #if mmap
7 $ cat <<EOF >> $HGRCPATH
8 > [storage]
9 > revbranchcache.mmap=true
10 > EOF
11 #else
12 $ cat <<EOF >> $HGRCPATH
13 > [storage]
14 > revbranchcache.mmap=false
15 > EOF
16 #endif
17
18 #if v3
19 $ cat <<EOF >> $HGRCPATH
20 > [experimental]
21 > branch-cache-v3=yes
22 > EOF
23 $ CACHE_PREFIX=branch3
24 #else
25 $ cat <<EOF >> $HGRCPATH
26 > [experimental]
27 > branch-cache-v3=no
28 > EOF
29 $ CACHE_PREFIX=branch2
30 #endif
31
32 $ show_cache() {
33 > for cache_file in .hg/cache/$CACHE_PREFIX*; do
34 > echo "##### $cache_file"
35 > cat $cache_file
36 > done
37 > }
38
39 $ hg init a
40 $ cd a
41
42 Verify checking branch of nullrev before the cache is created doesnt crash
43 $ hg log -r 'branch(.)' -T '{branch}\n'
44
45 Basic test
46 $ echo 'root' >root
47 $ hg add root
48 $ hg commit -d '0 0' -m "Adding root node"
49
50 $ echo 'a' >a
51 $ hg add a
52 $ hg branch a
53 marked working directory as branch a
54 (branches are permanent and global, did you want a bookmark?)
55 $ hg commit -d '1 0' -m "Adding a branch"
56
57 $ hg branch q
58 marked working directory as branch q
59 $ echo 'aa' >a
60 $ hg branch -C
61 reset working directory to branch a
62 $ hg commit -d '2 0' -m "Adding to a branch"
63
64 $ hg update -C 0
65 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
66 $ echo 'b' >b
67 $ hg add b
68 $ hg branch b
69 marked working directory as branch b
70 $ hg commit -d '2 0' -m "Adding b branch"
71
72 $ echo 'bh1' >bh1
73 $ hg add bh1
74 $ hg commit -d '3 0' -m "Adding b branch head 1"
75
76 $ hg update -C 2
77 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
78 $ echo 'bh2' >bh2
79 $ hg add bh2
80 $ hg commit -d '4 0' -m "Adding b branch head 2"
81
82 $ echo 'c' >c
83 $ hg add c
84 $ hg branch c
85 marked working directory as branch c
86 $ hg commit -d '5 0' -m "Adding c branch"
87
88 reserved names
89
90 $ hg branch tip
91 abort: the name 'tip' is reserved
92 [10]
93 $ hg branch null
94 abort: the name 'null' is reserved
95 [10]
96 $ hg branch .
97 abort: the name '.' is reserved
98 [10]
99
100 invalid characters
101
102 $ hg branch 'foo:bar'
103 abort: ':' cannot be used in a name
104 [10]
105
106 $ hg branch 'foo
107 > bar'
108 abort: '\n' cannot be used in a name
109 [10]
110
111 trailing or leading spaces should be stripped before testing duplicates
112
113 $ hg branch 'b '
114 abort: a branch of the same name already exists
115 (use 'hg update' to switch to it)
116 [10]
117
118 $ hg branch ' b'
119 abort: a branch of the same name already exists
120 (use 'hg update' to switch to it)
121 [10]
122
123 underscores in numeric branch names (issue6737)
124
125 $ hg branch 2700_210
126 marked working directory as branch 2700_210
127
128 verify update will accept invalid legacy branch names
129
130 $ hg init test-invalid-branch-name
131 $ cd test-invalid-branch-name
132 $ hg unbundle -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
133 adding changesets
134 adding manifests
135 adding file changes
136 added 3 changesets with 3 changes to 2 files
137 new changesets f0e4c7f04036:33c2ceb9310b (3 drafts)
138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139
140 $ hg update '"colon:test"'
141 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
142 $ cd ..
143
144 $ echo 'd' >d
145 $ hg add d
146 $ hg branch 'a branch name much longer than the default justification used by branches'
147 marked working directory as branch a branch name much longer than the default justification used by branches
148 $ hg commit -d '6 0' -m "Adding d branch"
149
150 $ hg branches
151 a branch name much longer than the default justification used by branches 7:10ff5895aa57
152 b 4:aee39cd168d0
153 c 6:589736a22561 (inactive)
154 a 5:d8cbc61dbaa6 (inactive)
155 default 0:19709c5a4e75 (inactive)
156
157 -------
158
159 $ hg branches -a
160 a branch name much longer than the default justification used by branches 7:10ff5895aa57
161 b 4:aee39cd168d0
162
163 --- Branch a
164
165 $ hg log -b a
166 changeset: 5:d8cbc61dbaa6
167 branch: a
168 parent: 2:881fe2b92ad0
169 user: test
170 date: Thu Jan 01 00:00:04 1970 +0000
171 summary: Adding b branch head 2
172
173 changeset: 2:881fe2b92ad0
174 branch: a
175 user: test
176 date: Thu Jan 01 00:00:02 1970 +0000
177 summary: Adding to a branch
178
179 changeset: 1:dd6b440dd85a
180 branch: a
181 user: test
182 date: Thu Jan 01 00:00:01 1970 +0000
183 summary: Adding a branch
184
185
186 ---- Branch b
187
188 $ hg log -b b
189 changeset: 4:aee39cd168d0
190 branch: b
191 user: test
192 date: Thu Jan 01 00:00:03 1970 +0000
193 summary: Adding b branch head 1
194
195 changeset: 3:ac22033332d1
196 branch: b
197 parent: 0:19709c5a4e75
198 user: test
199 date: Thu Jan 01 00:00:02 1970 +0000
200 summary: Adding b branch
201
202
203 ---- going to test branch listing by rev
204 $ hg branches -r0
205 default 0:19709c5a4e75 (inactive)
206 $ hg branches -qr0
207 default
208 --- now more than one rev
209 $ hg branches -r2:5
210 b 4:aee39cd168d0
211 a 5:d8cbc61dbaa6 (inactive)
212 $ hg branches -qr2:5
213 b
214 a
215 ---- going to test branch closing
216
217 $ hg branches
218 a branch name much longer than the default justification used by branches 7:10ff5895aa57
219 b 4:aee39cd168d0
220 c 6:589736a22561 (inactive)
221 a 5:d8cbc61dbaa6 (inactive)
222 default 0:19709c5a4e75 (inactive)
223 $ hg up -C b
224 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
225 $ echo 'xxx1' >> b
226 $ hg commit -d '7 0' -m 'adding cset to branch b'
227 $ hg up -C aee39cd168d0
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 $ echo 'xxx2' >> b
230 $ hg commit -d '8 0' -m 'adding head to branch b'
231 created new head
232 $ echo 'xxx3' >> b
233 $ hg commit -d '9 0' -m 'adding another cset to branch b'
234 $ hg branches
235 b 10:bfbe841b666e
236 a branch name much longer than the default justification used by branches 7:10ff5895aa57
237 c 6:589736a22561 (inactive)
238 a 5:d8cbc61dbaa6 (inactive)
239 default 0:19709c5a4e75 (inactive)
240 $ hg heads --closed
241 changeset: 10:bfbe841b666e
242 branch: b
243 tag: tip
244 user: test
245 date: Thu Jan 01 00:00:09 1970 +0000
246 summary: adding another cset to branch b
247
248 changeset: 8:eebb944467c9
249 branch: b
250 parent: 4:aee39cd168d0
251 user: test
252 date: Thu Jan 01 00:00:07 1970 +0000
253 summary: adding cset to branch b
254
255 changeset: 7:10ff5895aa57
256 branch: a branch name much longer than the default justification used by branches
257 user: test
258 date: Thu Jan 01 00:00:06 1970 +0000
259 summary: Adding d branch
260
261 changeset: 6:589736a22561
262 branch: c
263 user: test
264 date: Thu Jan 01 00:00:05 1970 +0000
265 summary: Adding c branch
266
267 changeset: 5:d8cbc61dbaa6
268 branch: a
269 parent: 2:881fe2b92ad0
270 user: test
271 date: Thu Jan 01 00:00:04 1970 +0000
272 summary: Adding b branch head 2
273
274 changeset: 0:19709c5a4e75
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: Adding root node
278
279 $ hg heads
280 changeset: 10:bfbe841b666e
281 branch: b
282 tag: tip
283 user: test
284 date: Thu Jan 01 00:00:09 1970 +0000
285 summary: adding another cset to branch b
286
287 changeset: 8:eebb944467c9
288 branch: b
289 parent: 4:aee39cd168d0
290 user: test
291 date: Thu Jan 01 00:00:07 1970 +0000
292 summary: adding cset to branch b
293
294 changeset: 7:10ff5895aa57
295 branch: a branch name much longer than the default justification used by branches
296 user: test
297 date: Thu Jan 01 00:00:06 1970 +0000
298 summary: Adding d branch
299
300 changeset: 6:589736a22561
301 branch: c
302 user: test
303 date: Thu Jan 01 00:00:05 1970 +0000
304 summary: Adding c branch
305
306 changeset: 5:d8cbc61dbaa6
307 branch: a
308 parent: 2:881fe2b92ad0
309 user: test
310 date: Thu Jan 01 00:00:04 1970 +0000
311 summary: Adding b branch head 2
312
313 changeset: 0:19709c5a4e75
314 user: test
315 date: Thu Jan 01 00:00:00 1970 +0000
316 summary: Adding root node
317
318 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
319 $ hg branches -a
320 b 8:eebb944467c9
321 a branch name much longer than the default justification used by branches 7:10ff5895aa57
322 $ hg up -C b
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
325 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
326 abort: current revision is already a branch closing head
327 [10]
328
329 $ echo foo > b
330 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
331
332 $ echo bar > b
333 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' bh1
334 abort: current revision is already a branch closing head
335 [10]
336 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' b
337
338 $ echo baz > b
339 $ hg commit -d '9 0' --close-branch -m 'empty re-closing this branch' -X b
340 abort: current revision is already a branch closing head
341 [10]
342 $ hg revert b
343
344 $ hg debugstrip --rev 13: --no-backup
345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 $ hg revert --all --no-backup
347
348 $ hg log -r tip --debug
349 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
350 branch: b
351 tag: tip
352 phase: draft
353 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
354 parent: -1:0000000000000000000000000000000000000000
355 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
356 user: test
357 date: Thu Jan 01 00:00:09 1970 +0000
358 extra: branch=b
359 extra: close=1
360 description:
361 close this part branch too
362
363
364 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} - {closesbranch} {node|short}\n'
365 @ b X - true e3d49c0575d8
366 |
367 | _ b X - true d3f163457ebf
368 | |
369 | o b - false bfbe841b666e
370 | |
371 | o b - false 5f4061bb3f2a
372 | |
373 o | b - false eebb944467c9
374 |/
375 | o a branch name much longer than the default justification used by branches - false 10ff5895aa57
376 | |
377 | o c - false 589736a22561
378 | |
379 | o a - false d8cbc61dbaa6
380 | |
381 o | b - false aee39cd168d0
382 | |
383 o | b - false ac22033332d1
384 | |
385 | o a - false 881fe2b92ad0
386 | |
387 | o a - false dd6b440dd85a
388 |/
389 o default - false 19709c5a4e75
390
391
392 --- b branch should be inactive
393
394 $ hg branches
395 a branch name much longer than the default justification used by branches 7:10ff5895aa57
396 c 6:589736a22561 (inactive)
397 a 5:d8cbc61dbaa6 (inactive)
398 default 0:19709c5a4e75 (inactive)
399 $ hg branches -c
400 a branch name much longer than the default justification used by branches 7:10ff5895aa57
401 b 12:e3d49c0575d8 (closed)
402 c 6:589736a22561 (inactive)
403 a 5:d8cbc61dbaa6 (inactive)
404 default 0:19709c5a4e75 (inactive)
405 $ hg branches -a
406 a branch name much longer than the default justification used by branches 7:10ff5895aa57
407 $ hg branches -q
408 a branch name much longer than the default justification used by branches
409 c
410 a
411 default
412 $ hg heads b
413 no open branch heads found on branches b
414 [1]
415 $ hg heads --closed b
416 changeset: 12:e3d49c0575d8
417 branch: b
418 tag: tip
419 parent: 8:eebb944467c9
420 user: test
421 date: Thu Jan 01 00:00:09 1970 +0000
422 summary: close this part branch too
423
424 changeset: 11:d3f163457ebf
425 branch: b
426 user: test
427 date: Thu Jan 01 00:00:09 1970 +0000
428 summary: prune bad branch
429
430 $ echo 'xxx4' >> b
431 $ hg commit -d '9 0' -m 'reopen branch with a change'
432 reopening closed branch head 12
433
434 --- branch b is back in action
435
436 $ hg branches -a
437 b 13:e23b5505d1ad
438 a branch name much longer than the default justification used by branches 7:10ff5895aa57
439
440 ---- test heads listings
441
442 $ hg heads
443 changeset: 13:e23b5505d1ad
444 branch: b
445 tag: tip
446 user: test
447 date: Thu Jan 01 00:00:09 1970 +0000
448 summary: reopen branch with a change
449
450 changeset: 7:10ff5895aa57
451 branch: a branch name much longer than the default justification used by branches
452 user: test
453 date: Thu Jan 01 00:00:06 1970 +0000
454 summary: Adding d branch
455
456 changeset: 6:589736a22561
457 branch: c
458 user: test
459 date: Thu Jan 01 00:00:05 1970 +0000
460 summary: Adding c branch
461
462 changeset: 5:d8cbc61dbaa6
463 branch: a
464 parent: 2:881fe2b92ad0
465 user: test
466 date: Thu Jan 01 00:00:04 1970 +0000
467 summary: Adding b branch head 2
468
469 changeset: 0:19709c5a4e75
470 user: test
471 date: Thu Jan 01 00:00:00 1970 +0000
472 summary: Adding root node
473
474
475 branch default
476
477 $ hg heads default
478 changeset: 0:19709c5a4e75
479 user: test
480 date: Thu Jan 01 00:00:00 1970 +0000
481 summary: Adding root node
482
483
484 branch a
485
486 $ hg heads a
487 changeset: 5:d8cbc61dbaa6
488 branch: a
489 parent: 2:881fe2b92ad0
490 user: test
491 date: Thu Jan 01 00:00:04 1970 +0000
492 summary: Adding b branch head 2
493
494 $ hg heads --active a
495 no open branch heads found on branches a
496 [1]
497
498 branch b
499
500 $ hg heads b
501 changeset: 13:e23b5505d1ad
502 branch: b
503 tag: tip
504 user: test
505 date: Thu Jan 01 00:00:09 1970 +0000
506 summary: reopen branch with a change
507
508 $ hg heads --closed b
509 changeset: 13:e23b5505d1ad
510 branch: b
511 tag: tip
512 user: test
513 date: Thu Jan 01 00:00:09 1970 +0000
514 summary: reopen branch with a change
515
516 changeset: 11:d3f163457ebf
517 branch: b
518 user: test
519 date: Thu Jan 01 00:00:09 1970 +0000
520 summary: prune bad branch
521
522
523 reclose branch
524
525 $ hg up -C c
526 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
527 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
528 $ hg branches
529 b 13:e23b5505d1ad
530 a branch name much longer than the default justification used by branches 7:10ff5895aa57
531 a 5:d8cbc61dbaa6 (inactive)
532 default 0:19709c5a4e75 (inactive)
533 $ hg branches --closed
534 b 13:e23b5505d1ad
535 a branch name much longer than the default justification used by branches 7:10ff5895aa57
536 c 14:f894c25619d3 (closed)
537 a 5:d8cbc61dbaa6 (inactive)
538 default 0:19709c5a4e75 (inactive)
539
540 multihead branch
541
542 $ hg up -C default
543 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
544 $ hg branch m
545 marked working directory as branch m
546 $ touch m
547 $ hg add m
548 $ hg commit -d '10 0' -m 'multihead base'
549 $ echo "m1" >m
550 $ hg commit -d '10 0' -m 'head 1'
551 $ hg up -C '.^'
552 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
553 $ echo "m2" >m
554 $ hg commit -d '10 0' -m 'head 2'
555 created new head
556 $ hg log -b m
557 changeset: 17:df343b0df04f
558 branch: m
559 tag: tip
560 parent: 15:f3447637f53e
561 user: test
562 date: Thu Jan 01 00:00:10 1970 +0000
563 summary: head 2
564
565 changeset: 16:a58ca5d3bdf3
566 branch: m
567 user: test
568 date: Thu Jan 01 00:00:10 1970 +0000
569 summary: head 1
570
571 changeset: 15:f3447637f53e
572 branch: m
573 parent: 0:19709c5a4e75
574 user: test
575 date: Thu Jan 01 00:00:10 1970 +0000
576 summary: multihead base
577
578 $ hg heads --topo m
579 changeset: 17:df343b0df04f
580 branch: m
581 tag: tip
582 parent: 15:f3447637f53e
583 user: test
584 date: Thu Jan 01 00:00:10 1970 +0000
585 summary: head 2
586
587 changeset: 16:a58ca5d3bdf3
588 branch: m
589 user: test
590 date: Thu Jan 01 00:00:10 1970 +0000
591 summary: head 1
592
593 $ hg branches
594 m 17:df343b0df04f
595 b 13:e23b5505d1ad
596 a branch name much longer than the default justification used by branches 7:10ff5895aa57
597 a 5:d8cbc61dbaa6 (inactive)
598 default 0:19709c5a4e75 (inactive)
599
600 partially merge multihead branch
601
602 $ hg up -C default
603 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
604 $ hg branch md
605 marked working directory as branch md
606 $ hg merge m
607 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 (branch merge, don't forget to commit)
609 $ hg commit -d '11 0' -m 'merge head 2'
610 $ hg heads --topo m
611 changeset: 16:a58ca5d3bdf3
612 branch: m
613 user: test
614 date: Thu Jan 01 00:00:10 1970 +0000
615 summary: head 1
616
617 $ hg branches
618 md 18:c914c99f1fbb
619 m 17:df343b0df04f
620 b 13:e23b5505d1ad
621 a branch name much longer than the default justification used by branches 7:10ff5895aa57
622 a 5:d8cbc61dbaa6 (inactive)
623 default 0:19709c5a4e75 (inactive)
624
625 partially close multihead branch
626
627 $ hg up -C a58ca5d3bdf3
628 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
629 $ hg commit -d '12 0' -m 'close head 1' --close-branch
630 $ hg heads --topo m
631 changeset: 19:cd21a80baa3d
632 branch: m
633 tag: tip
634 parent: 16:a58ca5d3bdf3
635 user: test
636 date: Thu Jan 01 00:00:12 1970 +0000
637 summary: close head 1
638
639 $ hg branches
640 md 18:c914c99f1fbb
641 b 13:e23b5505d1ad
642 a branch name much longer than the default justification used by branches 7:10ff5895aa57
643 m 17:df343b0df04f (inactive)
644 a 5:d8cbc61dbaa6 (inactive)
645 default 0:19709c5a4e75 (inactive)
646
647 default branch colors:
648
649 $ cat <<EOF >> $HGRCPATH
650 > [extensions]
651 > color =
652 > [color]
653 > mode = ansi
654 > EOF
655
656 $ hg up -C b
657 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
658 $ hg branches --color=always
659 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
660 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
661 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
662 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
663 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
664 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
665
666 default closed branch color:
667
668 $ hg branches --color=always --closed
669 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
670 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
671 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
672 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
673 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
674 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
675 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
676
677 $ cat <<EOF >> $HGRCPATH
678 > [extensions]
679 > color =
680 > [color]
681 > branches.active = green
682 > branches.closed = blue
683 > branches.current = red
684 > branches.inactive = magenta
685 > log.changeset = cyan
686 > EOF
687
688 custom branch colors:
689
690 $ hg branches --color=always
691 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
692 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
693 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
694 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
695 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
696 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
697
698 custom closed branch color:
699
700 $ hg branches --color=always --closed
701 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
702 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
703 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
704 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
705 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
706 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
707 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
708
709 template output:
710
711 $ hg branches -Tjson --closed
712 [
713 {
714 "active": true,
715 "branch": "md",
716 "closed": false,
717 "current": false,
718 "node": "c914c99f1fbb2b1d785a0a939ed3f67275df18e9",
719 "rev": 18
720 },
721 {
722 "active": true,
723 "branch": "b",
724 "closed": false,
725 "current": true,
726 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
727 "rev": 13
728 },
729 {
730 "active": true,
731 "branch": "a branch name much longer than the default justification used by branches",
732 "closed": false,
733 "current": false,
734 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
735 "rev": 7
736 },
737 {
738 "active": false,
739 "branch": "m",
740 "closed": false,
741 "current": false,
742 "node": "df343b0df04feb2a946cd4b6e9520e552fef14ee",
743 "rev": 17
744 },
745 {
746 "active": false,
747 "branch": "c",
748 "closed": true,
749 "current": false,
750 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
751 "rev": 14
752 },
753 {
754 "active": false,
755 "branch": "a",
756 "closed": false,
757 "current": false,
758 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
759 "rev": 5
760 },
761 {
762 "active": false,
763 "branch": "default",
764 "closed": false,
765 "current": false,
766 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
767 "rev": 0
768 }
769 ]
770
771 $ hg branches --closed -T '{if(closed, "{branch}\n")}'
772 c
773
774 $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
775 md: merge head 2
776 b: reopen branch with a change
777 a: Adding d branch
778 m: head 2
779 a: Adding b branch head 2
780 default: Adding root node
781
782 $ cat <<'EOF' > "$TESTTMP/map-myjson"
783 > docheader = '\{\n'
784 > docfooter = '\n}\n'
785 > separator = ',\n'
786 > branches = ' {dict(branch, node|short)|json}'
787 > EOF
788 $ hg branches -T "$TESTTMP/map-myjson"
789 {
790 {"branch": "md", "node": "c914c99f1fbb"},
791 {"branch": "b", "node": "e23b5505d1ad"},
792 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
793 {"branch": "m", "node": "df343b0df04f"},
794 {"branch": "a", "node": "d8cbc61dbaa6"},
795 {"branch": "default", "node": "19709c5a4e75"}
796 }
797
798 $ cat <<'EOF' >> .hg/hgrc
799 > [templates]
800 > myjson = ' {dict(branch, node|short)|json}'
801 > myjson:docheader = '\{\n'
802 > myjson:docfooter = '\n}\n'
803 > myjson:separator = ',\n'
804 > EOF
805 $ hg branches -T myjson
806 {
807 {"branch": "md", "node": "c914c99f1fbb"},
808 {"branch": "b", "node": "e23b5505d1ad"},
809 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
810 {"branch": "m", "node": "df343b0df04f"},
811 {"branch": "a", "node": "d8cbc61dbaa6"},
812 {"branch": "default", "node": "19709c5a4e75"}
813 }
814
815 $ cat <<'EOF' >> .hg/hgrc
816 > [templates]
817 > :docheader = 'should not be selected as a docheader for literal templates\n'
818 > EOF
819 $ hg branches -T '{branch}\n'
820 md
821 b
822 a branch name much longer than the default justification used by branches
823 m
824 a
825 default
826
827 Tests of revision branch name caching
828
829 We rev branch cache is updated automatically. In these tests we use a trick to
830 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
831 rebuild that also will populate the rev branch cache.
832
833 revision branch cache is created when building the branch head cache
834 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
835 5
836 $ f --hexdump --size .hg/cache/rbc-*
837 .hg/cache/rbc-names-v2: size=92
838 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
839 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
840 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
841 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
842 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
843 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 |ranches.m.md|
844 .hg/cache/rbc-revs-v2: size=160
845 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
846 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
847 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
848 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
849 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
850 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
851 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
852 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
853 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
854 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
855
856 no errors when revbranchcache is not writable
857
858 $ echo >> .hg/cache/rbc-revs-v2
859 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v2_
860 $ mkdir .hg/cache/rbc-revs-v2
861 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
862 5
863 $ rmdir .hg/cache/rbc-revs-v2
864 $ mv .hg/cache/rbc-revs-v2_ .hg/cache/rbc-revs-v2
865
866 no errors when wlock cannot be acquired
867
868 #if unix-permissions
869 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v2_
870 $ rm -f .hg/cache/branch*
871 $ chmod 555 .hg
872 $ hg head a -T '{rev}\n'
873 5
874 $ chmod 755 .hg
875 $ mv .hg/cache/rbc-revs-v2_ .hg/cache/rbc-revs-v2
876 #endif
877
878 dealing with valid cache revs file but for extra trailing data
879 --------------------------------------------------------------
880
881 When the trailing data are smaller than a record, they are practically
882 invisible to the cache and ignored. No warning is issued about them.
883
884 $ echo '42' >> .hg/cache/rbc-revs-v2
885 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
886 5
887 $ f --size .hg/cache/rbc-revs*
888 .hg/cache/rbc-revs-v2: size=164
889
890 When the trailing data are larger than a record, they are seens as extra
891 (probably invalid) data. We warn about them when writing.
892
893 $ echo 'abracadabra!' >> .hg/cache/rbc-revs-v2
894 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
895 5
896 cache/rbc-revs-v2 contains 17 unknown trailing bytes
897 $ f --size .hg/cache/rbc-revs*
898 .hg/cache/rbc-revs-v2: size=177
899
900 recovery from invalid cache file with partial last record
901 ---------------------------------------------------------
902 $ mv .hg/cache/rbc-revs-v2 .
903 $ f -qDB 119 rbc-revs-v2 > .hg/cache/rbc-revs-v2
904 $ f --size .hg/cache/rbc-revs*
905 .hg/cache/rbc-revs-v2: size=119
906 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
907 5
908 resetting content of cache/rbc-revs-v2
909 $ f --size .hg/cache/rbc-revs*
910 .hg/cache/rbc-revs-v2: size=160
911 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
912
913 recovery from invalid cache file with missing record - no truncation
914 $ mv .hg/cache/rbc-revs-v2 .
915 $ f -qDB 112 rbc-revs-v2 > .hg/cache/rbc-revs-v2
916 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
917 5
918 $ f --size .hg/cache/rbc-revs*
919 .hg/cache/rbc-revs-v2: size=160
920 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
921
922 recovery from invalid cache file with some bad records
923 $ mv .hg/cache/rbc-revs-v2 .
924 $ f -qDB 8 rbc-revs-v2 > .hg/cache/rbc-revs-v2
925 $ f --size .hg/cache/rbc-revs*
926 .hg/cache/rbc-revs-v2: size=8
927 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
928 $ f -qDB 112 rbc-revs-v2 >> .hg/cache/rbc-revs-v2
929 $ f --size .hg/cache/rbc-revs*
930 .hg/cache/rbc-revs-v2: size=120
931 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
932 $ hg log -r 'branch(.)' -T '{rev} ' --debug
933 history modification detected - truncating revision branch cache to revision * (glob)
934 history modification detected - truncating revision branch cache to revision 1
935 3 4 8 9 10 11 12 13 resetting content of cache/rbc-revs-v2
936 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
937 5
938 resetting content of cache/rbc-revs-v2
939 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
940 .hg/cache/rbc-revs-v2: size=160
941 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
942 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
943 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....| (known-bad-output mmap windows10 !)
944
945 Smoothly reuse "v1" format if no v2 exists
946 ------------------------------------------
947
948 read only operation with valid data
949 (actively rewrite data)
950
951 $ rm .hg/cache/rbc-names-v2
952 $ rm .hg/cache/rbc-revs-v2
953 $ rm .hg/cache/branch*
954 $ hg head a -T '{rev}\n' --debug
955 5
956 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
957 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1
958 $ rm .hg/cache/branch*
959 $ hg head a -T '{rev}\n' --debug
960 5
961 $ f --size .hg/cache/rbc-*-*
962 .hg/cache/rbc-names-v1: size=92
963 .hg/cache/rbc-names-v2: size=92
964 .hg/cache/rbc-revs-v1: size=160
965 .hg/cache/rbc-revs-v2: size=160
966 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
967
968
969 Write operation write a full v2 files
970
971 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
972 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1
973 $ f --size .hg/cache/rbc-*
974 .hg/cache/rbc-names-v1: size=92
975 .hg/cache/rbc-revs-v1: size=160
976 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
977 $ hg branch not-here-for-long
978 marked working directory as branch not-here-for-long
979 $ hg ci -m not-long --debug
980 reusing manifest from p1 (no file change)
981 committing changelog
982 updating the branch cache
983 committed changeset * (glob)
984 $ f --size .hg/cache/rbc-*
985 .hg/cache/rbc-names-v1: size=92
986 .hg/cache/rbc-names-v2: size=110
987 .hg/cache/rbc-revs-v1: size=160
988 .hg/cache/rbc-revs-v2: size=168
989 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
990
991 So does explicit cache upgrade
992 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
993 $ mv .hg/cache/rbc-revs-v2 .hg/cache/rbc-revs-v1
994 $ f --size .hg/cache/rbc-*
995 .hg/cache/rbc-names-v1: size=110
996 .hg/cache/rbc-revs-v1: size=168
997 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
998 $ hg debugupdatecache
999 $ f --size .hg/cache/rbc-*
1000 .hg/cache/rbc-names-v1: size=110
1001 .hg/cache/rbc-names-v2: size=110
1002 .hg/cache/rbc-revs-v1: size=168
1003 .hg/cache/rbc-revs-v2: size=168
1004 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
1005
1006 With invalid v1 data, we rewrite it too (as v2)
1007
1008 $ cp .hg/cache/rbc-names-v2 .hg/cache/rbc-names-v1
1009 $ mv .hg/cache/rbc-names-v2 .hg/cache/rbc-revs-v1
1010 $ rm .hg/cache/rbc-revs-v2
1011 $ rm .hg/cache/branch*
1012 $
1013 $ hg head a -T '{rev}\n' --debug
1014 history modification detected - truncating revision branch cache to revision 0
1015 5
1016 $ f --size .hg/cache/rbc-*-*
1017 .hg/cache/rbc-names-v1: size=110
1018 .hg/cache/rbc-names-v2: size=110
1019 .hg/cache/rbc-revs-v1: size=110
1020 .hg/cache/rbc-revs-v2: size=168
1021 .hg/cache/rbc-revs-v2-*: size=119 (glob) (known-bad-output mmap windows10 !)
1022
1023 cleanup
1024
1025 $ hg up -qr '.^'
1026 $ hg rollback -qf
1027 $ rm .hg/cache/*
1028 $ hg debugupdatecache
1029 $ f --size .hg/cache/rbc-*
1030 .hg/cache/rbc-names-v2: size=92
1031 .hg/cache/rbc-revs-v2: size=160
1032
1033 cache is updated when committing
1034 $ hg branch i-will-regret-this
1035 marked working directory as branch i-will-regret-this
1036 $ hg ci -m regrets
1037 $ f --size .hg/cache/rbc-*
1038 .hg/cache/rbc-names-v2: size=111
1039 .hg/cache/rbc-revs-v2: size=168
1040
1041 update after rollback - the cache will be correct but rbc-names will will still
1042 contain the branch name even though it no longer is used
1043 $ hg up -qr '.^'
1044 $ hg rollback -qf
1045 $ f --size .hg/cache/rbc-names-*
1046 .hg/cache/rbc-names-v2: size=111
1047 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
1048 $ f --size .hg/cache/rbc-revs-*
1049 .hg/cache/rbc-revs-v2: size=168
1050
1051 cache is updated/truncated when stripping - it is thus very hard to get in a
1052 situation where the cache is out of sync and the hash check detects it
1053 $ hg --config extensions.strip= strip -r tip --nob
1054 $ f --size .hg/cache/rbc-revs*
1055 .hg/cache/rbc-revs-v2: size=152
1056
1057 cache is rebuilt when corruption is detected
1058 $ echo > .hg/cache/rbc-names-v2
1059 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
1060 referenced branch names not found - rebuilding revision branch cache from scratch
1061 8 9 10 11 12 13 resetting content of rbc-names-v2
1062 $ f --size .hg/cache/rbc-names-*
1063 .hg/cache/rbc-names-v2: size=84
1064 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
1065 [1]
1066 $ f --size .hg/cache/rbc-revs-*
1067 .hg/cache/rbc-revs-v2: size=152
1068
1069 Test that cache files are created and grows correctly:
1070
1071 $ rm .hg/cache/rbc*
1072 $ hg log -r "5 & branch(5)" -T "{rev}\n"
1073 5
1074
1075 (here v3 is querying branch info for heads so it warm much more of the cache)
1076
1077 #if v2
1078 $ f --size .hg/cache/rbc-*
1079 .hg/cache/rbc-names-v2: size=1
1080 .hg/cache/rbc-revs-v2: size=48
1081 #else
1082 $ f --size .hg/cache/rbc-*
1083 .hg/cache/rbc-names-v2: size=84
1084 .hg/cache/rbc-revs-v2: size=152
1085 #endif
1086
1087 $ cd ..
1088
1089 Test for multiple incorrect branch cache entries:
1090
1091 $ hg init b
1092 $ cd b
1093 $ touch f
1094 $ hg ci -Aqmf
1095 $ echo >> f
1096 $ hg ci -Amf
1097 $ hg branch -q branch
1098 $ hg ci -Amf
1099
1100 #if v2
1101
1102 $ f --size --sha256 .hg/cache/rbc-*
1103 .hg/cache/rbc-names-v2: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
1104 .hg/cache/rbc-revs-v2: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
1105
1106 $ : > .hg/cache/rbc-revs-v2
1107
1108 No superfluous rebuilding of cache:
1109 $ hg log -r "branch(null)&branch(branch)" --debug
1110 $ f --size --sha256 .hg/cache/rbc-*
1111 .hg/cache/rbc-names-v2: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
1112 .hg/cache/rbc-revs-v2: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
1113 #endif
1114
1115 $ cd ..
1116
1117 Test to make sure that `--close-branch` only works on a branch head:
1118 --------------------------------------------------------------------
1119 $ hg init closebranch
1120 $ cd closebranch
1121 $ for ch in a b c; do
1122 > echo $ch > $ch
1123 > hg add $ch
1124 > hg ci -m "added "$ch
1125 > done;
1126
1127 $ hg up -r "desc('added b')"
1128 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1129
1130 trying to close branch from a cset which is not a branch head
1131 it should abort:
1132 $ hg ci -m "closing branch" --close-branch
1133 abort: can only close branch heads
1134 (use --force-close-branch to close branch from a non-head changeset)
1135 [10]
1136
1137 $ hg up 0
1138 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1139 $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
1140 o 2: 155349b645be added c
1141 | default
1142 |
1143 o 1: 5f6d8a4bf34a added b
1144 | default
1145 |
1146 @ 0: 9092f1db7931 added a
1147 default
1148
1149 Test --force-close-branch to close a branch from a non-head changeset:
1150 ---------------------------------------------------------------------
1151
1152 $ hg show stack --config extensions.show=
1153 o 1553 added c
1154 o 5f6d added b
1155 @ 9092 added a
1156
1157 $ hg ci -m "branch closed" --close-branch
1158 abort: can only close branch heads
1159 (use --force-close-branch to close branch from a non-head changeset)
1160 [10]
1161
1162 $ hg ci -m "branch closed" --force-close-branch
1163 created new head
1164 $ cd ..
1165
1166 Test various special cases for the branchmap
1167 --------------------------------------------
1168
1169 Basic fork of the same branch
1170
1171 $ hg init branchmap-testing1
1172 $ cd branchmap-testing1
1173 $ hg debugbuild '@A . :base . :p1 *base /p1'
1174 $ hg log -G
1175 o changeset: 3:71ca9a6d524e
1176 |\ branch: A
1177 | | tag: tip
1178 | | parent: 2:a3b807b3ff0b
1179 | | parent: 1:99ba08759bc7
1180 | | user: debugbuilddag
1181 | | date: Thu Jan 01 00:00:03 1970 +0000
1182 | | summary: r3
1183 | |
1184 | o changeset: 2:a3b807b3ff0b
1185 | | branch: A
1186 | | parent: 0:2ab8003a1750
1187 | | user: debugbuilddag
1188 | | date: Thu Jan 01 00:00:02 1970 +0000
1189 | | summary: r2
1190 | |
1191 o | changeset: 1:99ba08759bc7
1192 |/ branch: A
1193 | tag: p1
1194 | user: debugbuilddag
1195 | date: Thu Jan 01 00:00:01 1970 +0000
1196 | summary: r1
1197 |
1198 o changeset: 0:2ab8003a1750
1199 branch: A
1200 tag: base
1201 user: debugbuilddag
1202 date: Thu Jan 01 00:00:00 1970 +0000
1203 summary: r0
1204
1205 $ hg branches
1206 A 3:71ca9a6d524e
1207 $ hg clone -r 1 -r 2 . ../branchmap-testing1-clone
1208 adding changesets
1209 adding manifests
1210 adding file changes
1211 added 3 changesets with 0 changes to 0 files (+1 heads)
1212 new changesets 2ab8003a1750:a3b807b3ff0b
1213 updating to branch A
1214 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1215 $ cd ../branchmap-testing1-clone
1216 $ hg pull ../branchmap-testing1
1217 pulling from ../branchmap-testing1
1218 searching for changes
1219 adding changesets
1220 adding manifests
1221 adding file changes
1222 added 1 changesets with 0 changes to 0 files (-1 heads)
1223 new changesets 71ca9a6d524e
1224 (run 'hg update' to get a working copy)
1225 $ hg branches
1226 A 3:71ca9a6d524e
1227 $ cd ..
1228
1229 Switching to a different branch and back
1230
1231 $ hg init branchmap-testing2
1232 $ cd branchmap-testing2
1233 $ hg debugbuild '@A . @B . @A .'
1234 $ hg log -G
1235 o changeset: 2:9699e9f260b5
1236 | branch: A
1237 | tag: tip
1238 | user: debugbuilddag
1239 | date: Thu Jan 01 00:00:02 1970 +0000
1240 | summary: r2
1241 |
1242 o changeset: 1:0bc7d348d965
1243 | branch: B
1244 | user: debugbuilddag
1245 | date: Thu Jan 01 00:00:01 1970 +0000
1246 | summary: r1
1247 |
1248 o changeset: 0:2ab8003a1750
1249 branch: A
1250 user: debugbuilddag
1251 date: Thu Jan 01 00:00:00 1970 +0000
1252 summary: r0
1253
1254 $ hg branches
1255 A 2:9699e9f260b5
1256 B 1:0bc7d348d965 (inactive)
1257 $ hg clone -r 1 . ../branchmap-testing2-clone
1258 adding changesets
1259 adding manifests
1260 adding file changes
1261 added 2 changesets with 0 changes to 0 files
1262 new changesets 2ab8003a1750:0bc7d348d965
1263 updating to branch B
1264 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1265 $ cd ../branchmap-testing2-clone
1266 $ hg pull ../branchmap-testing2
1267 pulling from ../branchmap-testing2
1268 searching for changes
1269 adding changesets
1270 adding manifests
1271 adding file changes
1272 added 1 changesets with 0 changes to 0 files
1273 new changesets 9699e9f260b5
1274 (run 'hg update' to get a working copy)
1275 $ hg branches
1276 A 2:9699e9f260b5
1277 B 1:0bc7d348d965 (inactive)
1278 $ cd ..
1279
1280 A fork on a branch switching to a different branch and back
1281 is still collecting the fork.
1282
1283 $ hg init branchmap-testing3
1284 $ cd branchmap-testing3
1285 $ hg debugbuild '@A . :base . :p1 *base @B . @A /p1'
1286 $ hg log -G
1287 o changeset: 4:3614a1711d23
1288 |\ branch: A
1289 | | tag: tip
1290 | | parent: 3:e9c8abcf65aa
1291 | | parent: 1:99ba08759bc7
1292 | | user: debugbuilddag
1293 | | date: Thu Jan 01 00:00:04 1970 +0000
1294 | | summary: r4
1295 | |
1296 | o changeset: 3:e9c8abcf65aa
1297 | | branch: B
1298 | | user: debugbuilddag
1299 | | date: Thu Jan 01 00:00:03 1970 +0000
1300 | | summary: r3
1301 | |
1302 | o changeset: 2:a3b807b3ff0b
1303 | | branch: A
1304 | | parent: 0:2ab8003a1750
1305 | | user: debugbuilddag
1306 | | date: Thu Jan 01 00:00:02 1970 +0000
1307 | | summary: r2
1308 | |
1309 o | changeset: 1:99ba08759bc7
1310 |/ branch: A
1311 | tag: p1
1312 | user: debugbuilddag
1313 | date: Thu Jan 01 00:00:01 1970 +0000
1314 | summary: r1
1315 |
1316 o changeset: 0:2ab8003a1750
1317 branch: A
1318 tag: base
1319 user: debugbuilddag
1320 date: Thu Jan 01 00:00:00 1970 +0000
1321 summary: r0
1322
1323 $ hg branches
1324 A 4:3614a1711d23
1325 B 3:e9c8abcf65aa (inactive)
1326 $ hg clone -r 1 -r 3 . ../branchmap-testing3-clone
1327 adding changesets
1328 adding manifests
1329 adding file changes
1330 added 4 changesets with 0 changes to 0 files (+1 heads)
1331 new changesets 2ab8003a1750:e9c8abcf65aa
1332 updating to branch A
1333 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1334 $ cd ../branchmap-testing3-clone
1335 $ hg pull ../branchmap-testing3
1336 pulling from ../branchmap-testing3
1337 searching for changes
1338 adding changesets
1339 adding manifests
1340 adding file changes
1341 added 1 changesets with 0 changes to 0 files (-1 heads)
1342 new changesets 3614a1711d23
1343 (run 'hg update' to get a working copy)
1344 $ hg branches
1345 A 4:3614a1711d23
1346 B 3:e9c8abcf65aa (inactive)
1347 $ cd ..
1348
1349 Intermediary parents are on different branches.
1350
1351 $ hg init branchmap-testing4
1352 $ cd branchmap-testing4
1353 $ hg debugbuild '@A . @B :base . @A :p1 *base @C . @A /p1'
1354 $ hg log -G
1355 o changeset: 4:4bf67499b70a
1356 |\ branch: A
1357 | | tag: tip
1358 | | parent: 3:4a546028fa8f
1359 | | parent: 1:0bc7d348d965
1360 | | user: debugbuilddag
1361 | | date: Thu Jan 01 00:00:04 1970 +0000
1362 | | summary: r4
1363 | |
1364 | o changeset: 3:4a546028fa8f
1365 | | branch: C
1366 | | user: debugbuilddag
1367 | | date: Thu Jan 01 00:00:03 1970 +0000
1368 | | summary: r3
1369 | |
1370 | o changeset: 2:a3b807b3ff0b
1371 | | branch: A
1372 | | parent: 0:2ab8003a1750
1373 | | user: debugbuilddag
1374 | | date: Thu Jan 01 00:00:02 1970 +0000
1375 | | summary: r2
1376 | |
1377 o | changeset: 1:0bc7d348d965
1378 |/ branch: B
1379 | tag: p1
1380 | user: debugbuilddag
1381 | date: Thu Jan 01 00:00:01 1970 +0000
1382 | summary: r1
1383 |
1384 o changeset: 0:2ab8003a1750
1385 branch: A
1386 tag: base
1387 user: debugbuilddag
1388 date: Thu Jan 01 00:00:00 1970 +0000
1389 summary: r0
1390
1391 $ hg branches
1392 A 4:4bf67499b70a
1393 C 3:4a546028fa8f (inactive)
1394 B 1:0bc7d348d965 (inactive)
1395 $ hg clone -r 1 -r 3 . ../branchmap-testing4-clone
1396 adding changesets
1397 adding manifests
1398 adding file changes
1399 added 4 changesets with 0 changes to 0 files (+1 heads)
1400 new changesets 2ab8003a1750:4a546028fa8f
1401 updating to branch B
1402 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1403 $ cd ../branchmap-testing4-clone
1404 $ hg pull ../branchmap-testing4
1405 pulling from ../branchmap-testing4
1406 searching for changes
1407 adding changesets
1408 adding manifests
1409 adding file changes
1410 added 1 changesets with 0 changes to 0 files (-1 heads)
1411 new changesets 4bf67499b70a
1412 (run 'hg update' to get a working copy)
1413 $ hg branches
1414 A 4:4bf67499b70a
1415 C 3:4a546028fa8f (inactive)
1416 B 1:0bc7d348d965 (inactive)
1417 $ cd ..
1418
1419 Check that the cache are not written too early
1420 ----------------------------------------------
1421
1422 $ hg log -R branchmap-testing1 -G
1423 o changeset: 3:71ca9a6d524e
1424 |\ branch: A
1425 | | tag: tip
1426 | | parent: 2:a3b807b3ff0b
1427 | | parent: 1:99ba08759bc7
1428 | | user: debugbuilddag
1429 | | date: Thu Jan 01 00:00:03 1970 +0000
1430 | | summary: r3
1431 | |
1432 | o changeset: 2:a3b807b3ff0b
1433 | | branch: A
1434 | | parent: 0:2ab8003a1750
1435 | | user: debugbuilddag
1436 | | date: Thu Jan 01 00:00:02 1970 +0000
1437 | | summary: r2
1438 | |
1439 o | changeset: 1:99ba08759bc7
1440 |/ branch: A
1441 | tag: p1
1442 | user: debugbuilddag
1443 | date: Thu Jan 01 00:00:01 1970 +0000
1444 | summary: r1
1445 |
1446 o changeset: 0:2ab8003a1750
1447 branch: A
1448 tag: base
1449 user: debugbuilddag
1450 date: Thu Jan 01 00:00:00 1970 +0000
1451 summary: r0
1452
1453 $ hg bundle -R branchmap-testing1 --base 1 bundle.hg --rev 'head()'
1454 2 changesets found
1455
1456 Unbundling revision should warm the served cache
1457
1458 $ hg clone branchmap-testing1 --rev 1 branchmap-update-01
1459 adding changesets
1460 adding manifests
1461 adding file changes
1462 added 2 changesets with 0 changes to 0 files
1463 new changesets 2ab8003a1750:99ba08759bc7
1464 updating to branch A
1465 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1466 #if v3
1467 $ cat branchmap-update-01/.hg/cache/branch3-base
1468 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1469 A
1470 #else
1471 $ cat branchmap-update-01/.hg/cache/branch2-base
1472 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1473 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1474 #endif
1475 $ hg -R branchmap-update-01 unbundle bundle.hg
1476 adding changesets
1477 adding manifests
1478 adding file changes
1479 added 2 changesets with 0 changes to 0 files
1480 new changesets a3b807b3ff0b:71ca9a6d524e (2 drafts)
1481 (run 'hg update' to get a working copy)
1482 #if v3
1483 $ cat branchmap-update-01/.hg/cache/branch3-served
1484 tip-node=71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 tip-rev=3 topo-mode=pure
1485 A
1486 #else
1487 $ cat branchmap-update-01/.hg/cache/branch2-served
1488 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 3
1489 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 o A
1490 #endif
1491
1492 aborted Unbundle should not update the on disk cache
1493
1494 $ cat >> simplehook.py << EOF
1495 > import sys
1496 > from mercurial import node
1497 > from mercurial import branchmap
1498 > def hook(ui, repo, *args, **kwargs):
1499 > s = repo.filtered(b"served")
1500 > s.branchmap()
1501 > return 1
1502 > EOF
1503 $ hg clone branchmap-testing1 --rev 1 branchmap-update-02
1504 adding changesets
1505 adding manifests
1506 adding file changes
1507 added 2 changesets with 0 changes to 0 files
1508 new changesets 2ab8003a1750:99ba08759bc7
1509 updating to branch A
1510 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1511
1512 #if v3
1513 $ cat branchmap-update-02/.hg/cache/branch3-base
1514 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1515 A
1516 #else
1517 $ cat branchmap-update-02/.hg/cache/branch2-base
1518 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1519 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1520 #endif
1521 $ hg -R branchmap-update-02 unbundle bundle.hg --config "hooks.pretxnclose=python:$TESTTMP/simplehook.py:hook"
1522 adding changesets
1523 adding manifests
1524 adding file changes
1525 transaction abort!
1526 rollback completed
1527 abort: pretxnclose hook failed
1528 [40]
1529 #if v3
1530 $ cat branchmap-update-02/.hg/cache/branch3-base
1531 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1 topo-mode=pure
1532 A
1533 #else
1534 $ cat branchmap-update-02/.hg/cache/branch2-base
1535 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1536 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1537 #endif
1538
1539
1540 Automatic detection of the pure-topo mode for branchmap v3
1541 ==========================================================
1542
1543 The repository is in a pure-topo state
1544
1545 $ cd branchmap-testing4-clone
1546
1547 The cache might not have detected that yet.
1548
1549 #if v3
1550 $ show_cache
1551 ##### .hg/cache/branch3-base
1552 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4
1553 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1554 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1555 #else
1556 $ show_cache
1557 ##### .hg/cache/branch2-base
1558 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1559 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1560 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1561 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1562 #endif
1563
1564 $ hg update A
1565 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1566 $ hg debugupdatecache # make sure previous event doesn't influence the test
1567 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n'
1568 @ A 4bf67499b70a
1569 |\
1570 | o C 4a546028fa8f
1571 | |
1572 | o A a3b807b3ff0b
1573 | |
1574 o | B 0bc7d348d965
1575 |/
1576 o A 2ab8003a1750
1577
1578
1579 #if v3
1580 $ show_cache
1581 ##### .hg/cache/branch3-base
1582 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1583 A
1584 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1585 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1586 #else
1587 $ show_cache
1588 ##### .hg/cache/branch2-base
1589 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1590 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1591 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1592 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1593 #endif
1594
1595 $ hg branches
1596 A 4:4bf67499b70a
1597 C 3:4a546028fa8f (inactive)
1598 B 1:0bc7d348d965 (inactive)
1599
1600 #if v3
1601 $ show_cache
1602 ##### .hg/cache/branch3-base
1603 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1604 A
1605 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1606 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1607 #else
1608 $ show_cache
1609 ##### .hg/cache/branch2-base
1610 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1611 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1612 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1613 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1614 #endif
1615
1616 We close the top head
1617
1618 output must remain correct, and the branch is not in a topo-head state
1619
1620 $ hg commit --close-branch -m 'close the topo head'
1621 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n' --rev 'public()'
1622 o A 4bf67499b70a
1623 |\
1624 | o C 4a546028fa8f
1625 | |
1626 | o A a3b807b3ff0b
1627 | |
1628 o | B 0bc7d348d965
1629 |/
1630 o A 2ab8003a1750
1631
1632 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n'
1633 @ A X db99163c2f3f
1634 |
1635 o A 4bf67499b70a
1636 |\
1637 | o C 4a546028fa8f
1638 | |
1639 | o A a3b807b3ff0b
1640 | |
1641 o | B 0bc7d348d965
1642 |/
1643 o A 2ab8003a1750
1644
1645 $ hg branches
1646 C 3:4a546028fa8f (inactive)
1647 B 1:0bc7d348d965 (inactive)
1648
1649 #if v3
1650 $ show_cache
1651 ##### .hg/cache/branch3-base
1652 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1653 A
1654 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1655 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1656 ##### .hg/cache/branch3-served
1657 tip-node=db99163c2f3fc6ff219f3e3c071543cd3b9dddc8 tip-rev=5
1658 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1659 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1660 #else
1661 $ show_cache
1662 ##### .hg/cache/branch2-base
1663 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1664 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1665 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1666 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1667 ##### .hg/cache/branch2-served
1668 db99163c2f3fc6ff219f3e3c071543cd3b9dddc8 5
1669 db99163c2f3fc6ff219f3e3c071543cd3b9dddc8 c A
1670 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1671 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1672 #endif
1673
1674
1675 We re-open the top head
1676 (we do a couple of commit to give the cache time to detect that this is pure-topo mode).
1677
1678 $ echo 1 >> foo
1679 $ hg add foo
1680 $ hg commit -m 'reopen'
1681 reopening closed branch head 5
1682 $ echo 2 >> foo
1683 $ hg commit -m 'another commit'
1684 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n' --rev 'public()'
1685 o A 4bf67499b70a
1686 |\
1687 | o C 4a546028fa8f
1688 | |
1689 | o A a3b807b3ff0b
1690 | |
1691 o | B 0bc7d348d965
1692 |/
1693 o A 2ab8003a1750
1694
1695 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n'
1696 @ A 18507f5e8524
1697 |
1698 o A 117ef0aff623
1699 |
1700 _ A X db99163c2f3f
1701 |
1702 o A 4bf67499b70a
1703 |\
1704 | o C 4a546028fa8f
1705 | |
1706 | o A a3b807b3ff0b
1707 | |
1708 o | B 0bc7d348d965
1709 |/
1710 o A 2ab8003a1750
1711
1712 $ hg branches
1713 A 7:18507f5e8524
1714 C 3:4a546028fa8f (inactive)
1715 B 1:0bc7d348d965 (inactive)
1716 #if v3
1717 $ show_cache
1718 ##### .hg/cache/branch3-base
1719 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1720 A
1721 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1722 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1723 ##### .hg/cache/branch3-served
1724 tip-node=18507f5e85242640bb3f97ea2087ec574c1f78e1 tip-rev=7 topo-mode=pure
1725 A
1726 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1727 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1728 #else
1729 $ show_cache
1730 ##### .hg/cache/branch2-base
1731 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1732 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1733 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1734 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1735 ##### .hg/cache/branch2-served
1736 18507f5e85242640bb3f97ea2087ec574c1f78e1 7
1737 18507f5e85242640bb3f97ea2087ec574c1f78e1 o A
1738 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1739 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1740 #endif
1741
1742
1743 Automatic detection of the mixed mode for branchmap v3
1744 ======================================================
1745
1746 Let's open branch C alongside branch A
1747
1748 $ hg up C
1749 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1750 $ mkcommit C1
1751 $ mkcommit C2
1752 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n'
1753 @ C aa41ed5f1e51
1754 |
1755 o C e29f33a0e41f
1756 |
1757 | o A 18507f5e8524
1758 | |
1759 | o A 117ef0aff623
1760 | |
1761 | _ A X db99163c2f3f
1762 | |
1763 | o A 4bf67499b70a
1764 |/|
1765 o | C 4a546028fa8f
1766 | |
1767 o | A a3b807b3ff0b
1768 | |
1769 | o B 0bc7d348d965
1770 |/
1771 o A 2ab8003a1750
1772
1773
1774 This should be detected by now
1775
1776 #if v3
1777 $ show_cache
1778 ##### .hg/cache/branch3-base
1779 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1780 A
1781 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1782 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1783 ##### .hg/cache/branch3-served
1784 tip-node=aa41ed5f1e512b754a138d564455ddd6017b7d34 tip-rev=9 topo-mode=mixed
1785 A
1786 C
1787
1788 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1789 #else
1790 $ show_cache
1791 ##### .hg/cache/branch2-base
1792 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1793 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1794 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1795 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1796 ##### .hg/cache/branch2-served
1797 aa41ed5f1e512b754a138d564455ddd6017b7d34 9
1798 18507f5e85242640bb3f97ea2087ec574c1f78e1 o A
1799 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1800 aa41ed5f1e512b754a138d564455ddd6017b7d34 o C
1801 #endif
1802
1803 And this is preserved over further update
1804
1805 $ mkcommit C3
1806 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n'
1807 @ C b3ad80eaca8a
1808 |
1809 o C aa41ed5f1e51
1810 |
1811 o C e29f33a0e41f
1812 |
1813 | o A 18507f5e8524
1814 | |
1815 | o A 117ef0aff623
1816 | |
1817 | _ A X db99163c2f3f
1818 | |
1819 | o A 4bf67499b70a
1820 |/|
1821 o | C 4a546028fa8f
1822 | |
1823 o | A a3b807b3ff0b
1824 | |
1825 | o B 0bc7d348d965
1826 |/
1827 o A 2ab8003a1750
1828
1829
1830 #if v3
1831 $ show_cache
1832 ##### .hg/cache/branch3-base
1833 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1834 A
1835 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1836 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1837 ##### .hg/cache/branch3-served
1838 tip-node=b3ad80eaca8a572cbca78ef07ece1013ead0707a tip-rev=10 topo-mode=mixed
1839 A
1840 C
1841
1842 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1843 #else
1844 $ show_cache
1845 ##### .hg/cache/branch2-base
1846 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1847 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1848 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1849 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1850 ##### .hg/cache/branch2-served
1851 b3ad80eaca8a572cbca78ef07ece1013ead0707a 10
1852 18507f5e85242640bb3f97ea2087ec574c1f78e1 o A
1853 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1854 b3ad80eaca8a572cbca78ef07ece1013ead0707a o C
1855 #endif
1856
1857 We can disable the new-head reports
1858 ===================================
1859
1860 $ hg up "A~1" --quiet
1861 $ mkcommit A-nh-01
1862 created new head
1863
1864 $ hg up "A~1" --quiet
1865 $ mkcommit A-nh-02 --config commands.commit.report-head-changes=no
1866
1867 cleanup the extra head
1868
1869 $ hg merge 'min(head() and branch("A"))'
1870 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1871 (branch merge, don't forget to commit)
1872 $ hg commit -m "A-merge-01"
1873 $ hg merge 'min(head() and branch("A"))'
1874 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1875 (branch merge, don't forget to commit)
1876 $ hg commit -m "A-merge-01"
1877
1878 We should detect when the mixed case become pure again
1879 ======================================================
1880
1881 moving from "mixed" with two branch to a single pure branch
1882 -----------------------------------------------------------
1883
1884 $ hg up C
1885 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
1886 $ hg merge A
1887 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1888 (branch merge, don't forget to commit)
1889
1890 (that commit touch multiple branch so the topo-mode become uncertain)
1891
1892 $ hg commit --m 'C4: make A non-topological'
1893 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short}\n'
1894 @ C 34cee33f7c02
1895 |\
1896 | o A fd86303ad553
1897 | |\
1898 | | o A 6e206935b2bf
1899 | | |\
1900 | | | o A b3bfa327da66
1901 | | | |
1902 | o---+ A bcb088263b0a
1903 | / /
1904 o | | C b3ad80eaca8a
1905 | | |
1906 o | | C aa41ed5f1e51
1907 | | |
1908 o | | C e29f33a0e41f
1909 | | |
1910 | o | A 18507f5e8524
1911 | |/
1912 | o A 117ef0aff623
1913 | |
1914 | _ A X db99163c2f3f
1915 | |
1916 | o A 4bf67499b70a
1917 |/|
1918 o | C 4a546028fa8f
1919 | |
1920 o | A a3b807b3ff0b
1921 | |
1922 | o B 0bc7d348d965
1923 |/
1924 o A 2ab8003a1750
1925
1926
1927 #if v3
1928 $ show_cache
1929 ##### .hg/cache/branch3-base
1930 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1931 A
1932 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1933 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1934 ##### .hg/cache/branch3-served
1935 tip-node=34cee33f7c02cb02fc18f913017859c862dd881d tip-rev=15
1936 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
1937 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1938 #else
1939 $ show_cache
1940 ##### .hg/cache/branch2-base
1941 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1942 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1943 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1944 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1945 ##### .hg/cache/branch2-served
1946 34cee33f7c02cb02fc18f913017859c862dd881d 15
1947 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
1948 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1949 34cee33f7c02cb02fc18f913017859c862dd881d o C
1950 #endif
1951
1952 The next commit should detect the pure mode again
1953
1954 $ mkcommit C5
1955
1956 #if v3
1957 $ show_cache
1958 ##### .hg/cache/branch3-base
1959 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
1960 A
1961 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1962 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1963 ##### .hg/cache/branch3-served
1964 tip-node=c4c34d5b96bb41179023634383d836bdf8d1d801 tip-rev=16 topo-mode=pure
1965 C
1966 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
1967 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1968 #else
1969 $ show_cache
1970 ##### .hg/cache/branch2-base
1971 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
1972 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
1973 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1974 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
1975 ##### .hg/cache/branch2-served
1976 c4c34d5b96bb41179023634383d836bdf8d1d801 16
1977 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
1978 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
1979 c4c34d5b96bb41179023634383d836bdf8d1d801 o C
1980 #endif
1981
1982 moving from "mixed" with a single branch that has some closed heads to pure
1983 ---------------------------------------------------------------------------
1984
1985 create some branching on C
1986
1987 $ mkcommit C6
1988 $ hg up "p1(.)"
1989 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1990 $ mkcommit C7
1991 created new head
1992
1993 $ hg log -G --rev 'desc("C5")::' -T '{branch} {if(closesbranch, "X", " ")} {node|short} {desc}\n'
1994 @ C 047375283028 C7
1995 |
1996 | o C c86818beac0c C6
1997 |/
1998 o C c4c34d5b96bb C5
1999 |
2000 ~
2001
2002 #if v3
2003 $ show_cache
2004 ##### .hg/cache/branch3-base
2005 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
2006 A
2007 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2008 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2009 ##### .hg/cache/branch3-served
2010 tip-node=0473752830287ce98829447e9e99031164494f69 tip-rev=18 topo-mode=pure
2011 C
2012 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2013 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2014 #else
2015 $ show_cache
2016 ##### .hg/cache/branch2-base
2017 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
2018 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
2019 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2020 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2021 ##### .hg/cache/branch2-served
2022 0473752830287ce98829447e9e99031164494f69 18
2023 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2024 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2025 c86818beac0c7f1c1c222fa9e4b66955081a4aaa o C
2026 0473752830287ce98829447e9e99031164494f69 o C
2027 #endif
2028
2029 close one of the two head
2030
2031 This should more the branchmap to "mixed" mode.
2032
2033 $ hg commit --close -m "C8"
2034 $ hg log -G --rev 'desc("C5")::' -T '{branch} {if(closesbranch, "X", " ")} {node|short} {desc}\n'
2035 @ C X 8dbda6043177 C8
2036 |
2037 o C 047375283028 C7
2038 |
2039 | o C c86818beac0c C6
2040 |/
2041 o C c4c34d5b96bb C5
2042 |
2043 ~
2044
2045 #if v3
2046 $ show_cache
2047 ##### .hg/cache/branch3-base
2048 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
2049 A
2050 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2051 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2052 ##### .hg/cache/branch3-served
2053 tip-node=8dbda6043177f599930c693e1d0bd9812a09de22 tip-rev=19
2054 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2055 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2056 #else
2057 $ show_cache
2058 ##### .hg/cache/branch2-base
2059 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
2060 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
2061 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2062 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2063 ##### .hg/cache/branch2-served
2064 8dbda6043177f599930c693e1d0bd9812a09de22 19
2065 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2066 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2067 c86818beac0c7f1c1c222fa9e4b66955081a4aaa o C
2068 8dbda6043177f599930c693e1d0bd9812a09de22 c C
2069 #endif
2070
2071 again we need a to do an extra iteration for the mixed mode to be detected,
2072 this is not ideal, but good enough.
2073
2074 $ hg up 'desc(C6)'
2075 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2076 $ mkcommit "C9"
2077 $ hg log -G --rev 'desc("C5")::' -T '{branch} {if(closesbranch, "X", " ")} {node|short} {desc}\n'
2078 @ C 7aa21c214701 C9
2079 |
2080 | _ C X 8dbda6043177 C8
2081 | |
2082 | o C 047375283028 C7
2083 | |
2084 o | C c86818beac0c C6
2085 |/
2086 o C c4c34d5b96bb C5
2087 |
2088 ~
2089
2090 #if v3
2091 $ show_cache
2092 ##### .hg/cache/branch3-base
2093 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
2094 A
2095 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2096 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2097 ##### .hg/cache/branch3-served
2098 tip-node=7aa21c2147015cd652b814072f89c5b8574f15cd tip-rev=20 topo-mode=mixed
2099 C
2100
2101 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2102 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2103 #else
2104 $ show_cache
2105 ##### .hg/cache/branch2-base
2106 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
2107 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
2108 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2109 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2110 ##### .hg/cache/branch2-served
2111 7aa21c2147015cd652b814072f89c5b8574f15cd 20
2112 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2113 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2114 8dbda6043177f599930c693e1d0bd9812a09de22 c C
2115 7aa21c2147015cd652b814072f89c5b8574f15cd o C
2116 #endif
2117
2118 now we get out of the mixed mode
2119
2120
2121 $ hg merge 'desc(C8)'
2122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2123 (branch merge, don't forget to commit)
2124 $ hg commit -m 'C10'
2125 reopening closed branch head 19
2126 $ hg log -G --rev 'desc("C5")::' -T '{branch} {if(closesbranch, "X", " ")} {node|short} {desc}\n'
2127 @ C 5d236290f36a C10
2128 |\
2129 | o C 7aa21c214701 C9
2130 | |
2131 _ | C X 8dbda6043177 C8
2132 | |
2133 o | C 047375283028 C7
2134 | |
2135 | o C c86818beac0c C6
2136 |/
2137 o C c4c34d5b96bb C5
2138 |
2139 ~
2140
2141 #if v3
2142 $ show_cache
2143 ##### .hg/cache/branch3-base
2144 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
2145 A
2146 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2147 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2148 ##### .hg/cache/branch3-served
2149 tip-node=5d236290f36a23b9cbb62b63dfb26f3e48ad13cb tip-rev=21 topo-mode=mixed (known-bad-output !)
2150 tip-node=81a2b751d30053e8ddd6e98467f1402ea2edf248 tip-rev=17 topo-mode=pure (missing-correct-output !)
2151 C
2152 (known-bad-output !)
2153 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2154 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2155 #else
2156 $ show_cache
2157 ##### .hg/cache/branch2-base
2158 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
2159 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
2160 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2161 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2162 ##### .hg/cache/branch2-served
2163 5d236290f36a23b9cbb62b63dfb26f3e48ad13cb 21
2164 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2165 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2166 5d236290f36a23b9cbb62b63dfb26f3e48ad13cb o C
2167 #endif
2168
2169 The next commit will detect the "pure" mode and update the cache.
2170
2171 $ mkcommit C11
2172
2173 #if v3
2174 $ show_cache
2175 ##### .hg/cache/branch3-base
2176 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
2177 A
2178 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2179 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2180 ##### .hg/cache/branch3-served
2181 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22 topo-mode=pure
2182 C
2183 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2184 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2185 #else
2186 $ show_cache
2187 ##### .hg/cache/branch2-base
2188 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
2189 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
2190 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2191 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2192 ##### .hg/cache/branch2-served
2193 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2194 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2195 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2196 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2197 #endif
2198
2199 upgrading through the closed heads that still end up in a pure mode
2200 -------------------------------------------------------------------
2201
2202 $ hg log -G -T '{branch} {if(closesbranch, "X", " ")} {node|short} [rev-{rev}] {desc}\n'
2203 @ C 2be6fe61602e [rev-22] C11
2204 |
2205 o C 5d236290f36a [rev-21] C10
2206 |\
2207 | o C 7aa21c214701 [rev-20] C9
2208 | |
2209 _ | C X 8dbda6043177 [rev-19] C8
2210 | |
2211 o | C 047375283028 [rev-18] C7
2212 | |
2213 | o C c86818beac0c [rev-17] C6
2214 |/
2215 o C c4c34d5b96bb [rev-16] C5
2216 |
2217 o C 34cee33f7c02 [rev-15] C4: make A non-topological
2218 |\
2219 | o A fd86303ad553 [rev-14] A-merge-01
2220 | |\
2221 | | o A 6e206935b2bf [rev-13] A-merge-01
2222 | | |\
2223 | | | o A b3bfa327da66 [rev-12] A-nh-02
2224 | | | |
2225 | o---+ A bcb088263b0a [rev-11] A-nh-01
2226 | / /
2227 o | | C b3ad80eaca8a [rev-10] C3
2228 | | |
2229 o | | C aa41ed5f1e51 [rev-9] C2
2230 | | |
2231 o | | C e29f33a0e41f [rev-8] C1
2232 | | |
2233 | o | A 18507f5e8524 [rev-7] another commit
2234 | |/
2235 | o A 117ef0aff623 [rev-6] reopen
2236 | |
2237 | _ A X db99163c2f3f [rev-5] close the topo head
2238 | |
2239 | o A 4bf67499b70a [rev-4] r4
2240 |/|
2241 o | C 4a546028fa8f [rev-3] r3
2242 | |
2243 o | A a3b807b3ff0b [rev-2] r2
2244 | |
2245 | o B 0bc7d348d965 [rev-1] r1
2246 |/
2247 o A 2ab8003a1750 [rev-0] r0
2248
2249 $ rm -f .hg/cache/branch?-served
2250 $ hg phase --public 'desc(C5)'
2251
2252 #if v3
2253 $ show_cache
2254 ##### .hg/cache/branch3-base
2255 tip-node=4bf67499b70aa5383056bc17ff96fd1e8d520970 tip-rev=4 topo-mode=pure
2256 A
2257 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2258 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2259 ##### .hg/cache/branch3-served
2260 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22
2261 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2262 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2263 #else
2264 $ show_cache
2265 ##### .hg/cache/branch2-base
2266 4bf67499b70aa5383056bc17ff96fd1e8d520970 4
2267 4bf67499b70aa5383056bc17ff96fd1e8d520970 o A
2268 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2269 4a546028fa8ffc732fbf46f6476f49d5572f4b22 o C
2270 ##### .hg/cache/branch2-served
2271 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2272 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2273 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2274 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2275 #endif
2276
2277 $ rm -f .hg/cache/branch?-served
2278 $ hg phase --public 'desc(C6)'
2279
2280 #if v3
2281 $ show_cache
2282 ##### .hg/cache/branch3-base
2283 tip-node=c4c34d5b96bb41179023634383d836bdf8d1d801 tip-rev=16
2284 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2285 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2286 ##### .hg/cache/branch3-served
2287 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22
2288 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2289 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2290 #else
2291 $ show_cache
2292 ##### .hg/cache/branch2-base
2293 c4c34d5b96bb41179023634383d836bdf8d1d801 16
2294 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2295 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2296 c4c34d5b96bb41179023634383d836bdf8d1d801 o C
2297 ##### .hg/cache/branch2-served
2298 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2299 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2300 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2301 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2302 #endif
2303
2304 $ rm -f .hg/cache/branch?-served
2305 $ hg phase --public 'desc(C10)'
2306
2307 #if v3
2308 $ show_cache
2309 ##### .hg/cache/branch3-base
2310 tip-node=c86818beac0c7f1c1c222fa9e4b66955081a4aaa tip-rev=17 topo-mode=pure
2311 C
2312 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2313 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2314 ##### .hg/cache/branch3-served
2315 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22
2316 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2317 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2318 #else
2319 $ show_cache
2320 ##### .hg/cache/branch2-base
2321 c86818beac0c7f1c1c222fa9e4b66955081a4aaa 17
2322 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2323 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2324 c86818beac0c7f1c1c222fa9e4b66955081a4aaa o C
2325 ##### .hg/cache/branch2-served
2326 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2327 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2328 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2329 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2330 #endif
2331
2332 $ rm -f .hg/cache/branch?-served
2333 $ hg phase --public 'desc(C11)'
2334
2335 #if v3
2336 $ show_cache
2337 ##### .hg/cache/branch3-base
2338 tip-node=5d236290f36a23b9cbb62b63dfb26f3e48ad13cb tip-rev=21
2339 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2340 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2341 ##### .hg/cache/branch3-served
2342 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22
2343 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2344 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2345 #else
2346 $ show_cache
2347 ##### .hg/cache/branch2-base
2348 5d236290f36a23b9cbb62b63dfb26f3e48ad13cb 21
2349 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2350 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2351 5d236290f36a23b9cbb62b63dfb26f3e48ad13cb o C
2352 ##### .hg/cache/branch2-served
2353 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2354 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2355 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2356 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2357 #endif
2358
2359 $ rm -f .hg/cache/branch?-served
2360 $ hg branches > /dev/null
2361
2362 #if v3
2363 $ show_cache
2364 ##### .hg/cache/branch3-base
2365 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22 topo-mode=pure
2366 C
2367 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2368 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2369 #else
2370 $ show_cache
2371 ##### .hg/cache/branch2-base
2372 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2373 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2374 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2375 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2376 #endif
2377
2378 explicit cache upgrade should detect the pure topo mode
2379 -------------------------------------------------------
2380
2381 $ hg phase --force --draft 'desc(C5)'
2382 $ hg debugupdatecache
2383
2384 #if v3
2385 $ show_cache
2386 ##### .hg/cache/branch3-base
2387 tip-node=34cee33f7c02cb02fc18f913017859c862dd881d tip-rev=15 topo-mode=pure
2388 C
2389 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2390 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2391 ##### .hg/cache/branch3-served
2392 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22 topo-mode=pure
2393 C
2394 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2395 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2396 #else
2397 $ show_cache
2398 ##### .hg/cache/branch2-base
2399 34cee33f7c02cb02fc18f913017859c862dd881d 15
2400 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2401 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2402 34cee33f7c02cb02fc18f913017859c862dd881d o C
2403 ##### .hg/cache/branch2-served
2404 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2405 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2406 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2407 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2408 #endif
2409
2410 explicit cache upgrade from scratch should detect the pure topo mode
2411 --------------------------------------------------------------------
2412
2413 $ rm -f .hg/cache/branch?
2414 $ rm -f .hg/cache/branch?-*
2415 $ hg debugupdatecache
2416
2417 #if v3
2418 $ show_cache
2419 ##### .hg/cache/branch3-base
2420 tip-node=34cee33f7c02cb02fc18f913017859c862dd881d tip-rev=15 topo-mode=pure
2421 C
2422 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2423 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2424 ##### .hg/cache/branch3-served
2425 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22 topo-mode=pure
2426 C
2427 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2428 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2429 #else
2430 $ show_cache
2431 ##### .hg/cache/branch2-base
2432 34cee33f7c02cb02fc18f913017859c862dd881d 15
2433 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2434 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2435 34cee33f7c02cb02fc18f913017859c862dd881d o C
2436 ##### .hg/cache/branch2-served
2437 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2438 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2439 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2440 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2441 #endif
2442
2443 $ hg debugupdatecache
2444
2445 #if v3
2446 $ show_cache
2447 ##### .hg/cache/branch3-base
2448 tip-node=34cee33f7c02cb02fc18f913017859c862dd881d tip-rev=15 topo-mode=pure
2449 C
2450 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2451 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2452 ##### .hg/cache/branch3-served
2453 tip-node=2be6fe61602ec536c615c76a452172c23dae3e0c tip-rev=22 topo-mode=pure
2454 C
2455 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2456 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2457 #else
2458 $ show_cache
2459 ##### .hg/cache/branch2-base
2460 34cee33f7c02cb02fc18f913017859c862dd881d 15
2461 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2462 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2463 34cee33f7c02cb02fc18f913017859c862dd881d o C
2464 ##### .hg/cache/branch2-served
2465 2be6fe61602ec536c615c76a452172c23dae3e0c 22
2466 fd86303ad5534310a9f6523e5530a4ac9550e078 o A
2467 0bc7d348d965a85078ec0cc80847c6992e024e36 o B
2468 2be6fe61602ec536c615c76a452172c23dae3e0c o C
2469 #endif