##// END OF EJS Templates
branchcache: simplify the branch rev cache test...
marmoute -
r52423:fc710c99 default
parent child Browse files
Show More
@@ -1,1409 +1,1375
1 1 #testcases mmap nommap
2 2 #testcases v2 v3
3 3
4 4 #if mmap
5 5 $ cat <<EOF >> $HGRCPATH
6 6 > [storage]
7 7 > revbranchcache.mmap=true
8 8 > EOF
9 9 #endif
10 10
11 11 #if v3
12 12 $ cat <<EOF >> $HGRCPATH
13 13 > [experimental]
14 14 > branch-cache-v3=yes
15 15 > EOF
16 16 #else
17 17 $ cat <<EOF >> $HGRCPATH
18 18 > [experimental]
19 19 > branch-cache-v3=no
20 20 > EOF
21 21 #endif
22 22
23 23 $ hg init a
24 24 $ cd a
25 25
26 26 Verify checking branch of nullrev before the cache is created doesnt crash
27 27 $ hg log -r 'branch(.)' -T '{branch}\n'
28 28
29 29 Basic test
30 30 $ echo 'root' >root
31 31 $ hg add root
32 32 $ hg commit -d '0 0' -m "Adding root node"
33 33
34 34 $ echo 'a' >a
35 35 $ hg add a
36 36 $ hg branch a
37 37 marked working directory as branch a
38 38 (branches are permanent and global, did you want a bookmark?)
39 39 $ hg commit -d '1 0' -m "Adding a branch"
40 40
41 41 $ hg branch q
42 42 marked working directory as branch q
43 43 $ echo 'aa' >a
44 44 $ hg branch -C
45 45 reset working directory to branch a
46 46 $ hg commit -d '2 0' -m "Adding to a branch"
47 47
48 48 $ hg update -C 0
49 49 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
50 50 $ echo 'b' >b
51 51 $ hg add b
52 52 $ hg branch b
53 53 marked working directory as branch b
54 54 $ hg commit -d '2 0' -m "Adding b branch"
55 55
56 56 $ echo 'bh1' >bh1
57 57 $ hg add bh1
58 58 $ hg commit -d '3 0' -m "Adding b branch head 1"
59 59
60 60 $ hg update -C 2
61 61 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 62 $ echo 'bh2' >bh2
63 63 $ hg add bh2
64 64 $ hg commit -d '4 0' -m "Adding b branch head 2"
65 65
66 66 $ echo 'c' >c
67 67 $ hg add c
68 68 $ hg branch c
69 69 marked working directory as branch c
70 70 $ hg commit -d '5 0' -m "Adding c branch"
71 71
72 72 reserved names
73 73
74 74 $ hg branch tip
75 75 abort: the name 'tip' is reserved
76 76 [10]
77 77 $ hg branch null
78 78 abort: the name 'null' is reserved
79 79 [10]
80 80 $ hg branch .
81 81 abort: the name '.' is reserved
82 82 [10]
83 83
84 84 invalid characters
85 85
86 86 $ hg branch 'foo:bar'
87 87 abort: ':' cannot be used in a name
88 88 [10]
89 89
90 90 $ hg branch 'foo
91 91 > bar'
92 92 abort: '\n' cannot be used in a name
93 93 [10]
94 94
95 95 trailing or leading spaces should be stripped before testing duplicates
96 96
97 97 $ hg branch 'b '
98 98 abort: a branch of the same name already exists
99 99 (use 'hg update' to switch to it)
100 100 [10]
101 101
102 102 $ hg branch ' b'
103 103 abort: a branch of the same name already exists
104 104 (use 'hg update' to switch to it)
105 105 [10]
106 106
107 107 underscores in numeric branch names (issue6737)
108 108
109 109 $ hg branch 2700_210
110 110 marked working directory as branch 2700_210
111 111
112 112 verify update will accept invalid legacy branch names
113 113
114 114 $ hg init test-invalid-branch-name
115 115 $ cd test-invalid-branch-name
116 116 $ hg unbundle -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
117 117 adding changesets
118 118 adding manifests
119 119 adding file changes
120 120 added 3 changesets with 3 changes to 2 files
121 121 new changesets f0e4c7f04036:33c2ceb9310b (3 drafts)
122 122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 123
124 124 $ hg update '"colon:test"'
125 125 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 126 $ cd ..
127 127
128 128 $ echo 'd' >d
129 129 $ hg add d
130 130 $ hg branch 'a branch name much longer than the default justification used by branches'
131 131 marked working directory as branch a branch name much longer than the default justification used by branches
132 132 $ hg commit -d '6 0' -m "Adding d branch"
133 133
134 134 $ hg branches
135 135 a branch name much longer than the default justification used by branches 7:10ff5895aa57
136 136 b 4:aee39cd168d0
137 137 c 6:589736a22561 (inactive)
138 138 a 5:d8cbc61dbaa6 (inactive)
139 139 default 0:19709c5a4e75 (inactive)
140 140
141 141 -------
142 142
143 143 $ hg branches -a
144 144 a branch name much longer than the default justification used by branches 7:10ff5895aa57
145 145 b 4:aee39cd168d0
146 146
147 147 --- Branch a
148 148
149 149 $ hg log -b a
150 150 changeset: 5:d8cbc61dbaa6
151 151 branch: a
152 152 parent: 2:881fe2b92ad0
153 153 user: test
154 154 date: Thu Jan 01 00:00:04 1970 +0000
155 155 summary: Adding b branch head 2
156 156
157 157 changeset: 2:881fe2b92ad0
158 158 branch: a
159 159 user: test
160 160 date: Thu Jan 01 00:00:02 1970 +0000
161 161 summary: Adding to a branch
162 162
163 163 changeset: 1:dd6b440dd85a
164 164 branch: a
165 165 user: test
166 166 date: Thu Jan 01 00:00:01 1970 +0000
167 167 summary: Adding a branch
168 168
169 169
170 170 ---- Branch b
171 171
172 172 $ hg log -b b
173 173 changeset: 4:aee39cd168d0
174 174 branch: b
175 175 user: test
176 176 date: Thu Jan 01 00:00:03 1970 +0000
177 177 summary: Adding b branch head 1
178 178
179 179 changeset: 3:ac22033332d1
180 180 branch: b
181 181 parent: 0:19709c5a4e75
182 182 user: test
183 183 date: Thu Jan 01 00:00:02 1970 +0000
184 184 summary: Adding b branch
185 185
186 186
187 187 ---- going to test branch listing by rev
188 188 $ hg branches -r0
189 189 default 0:19709c5a4e75 (inactive)
190 190 $ hg branches -qr0
191 191 default
192 192 --- now more than one rev
193 193 $ hg branches -r2:5
194 194 b 4:aee39cd168d0
195 195 a 5:d8cbc61dbaa6 (inactive)
196 196 $ hg branches -qr2:5
197 197 b
198 198 a
199 199 ---- going to test branch closing
200 200
201 201 $ hg branches
202 202 a branch name much longer than the default justification used by branches 7:10ff5895aa57
203 203 b 4:aee39cd168d0
204 204 c 6:589736a22561 (inactive)
205 205 a 5:d8cbc61dbaa6 (inactive)
206 206 default 0:19709c5a4e75 (inactive)
207 207 $ hg up -C b
208 208 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
209 209 $ echo 'xxx1' >> b
210 210 $ hg commit -d '7 0' -m 'adding cset to branch b'
211 211 $ hg up -C aee39cd168d0
212 212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 213 $ echo 'xxx2' >> b
214 214 $ hg commit -d '8 0' -m 'adding head to branch b'
215 215 created new head
216 216 $ echo 'xxx3' >> b
217 217 $ hg commit -d '9 0' -m 'adding another cset to branch b'
218 218 $ hg branches
219 219 b 10:bfbe841b666e
220 220 a branch name much longer than the default justification used by branches 7:10ff5895aa57
221 221 c 6:589736a22561 (inactive)
222 222 a 5:d8cbc61dbaa6 (inactive)
223 223 default 0:19709c5a4e75 (inactive)
224 224 $ hg heads --closed
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 heads
264 264 changeset: 10:bfbe841b666e
265 265 branch: b
266 266 tag: tip
267 267 user: test
268 268 date: Thu Jan 01 00:00:09 1970 +0000
269 269 summary: adding another cset to branch b
270 270
271 271 changeset: 8:eebb944467c9
272 272 branch: b
273 273 parent: 4:aee39cd168d0
274 274 user: test
275 275 date: Thu Jan 01 00:00:07 1970 +0000
276 276 summary: adding cset to branch b
277 277
278 278 changeset: 7:10ff5895aa57
279 279 branch: a branch name much longer than the default justification used by branches
280 280 user: test
281 281 date: Thu Jan 01 00:00:06 1970 +0000
282 282 summary: Adding d branch
283 283
284 284 changeset: 6:589736a22561
285 285 branch: c
286 286 user: test
287 287 date: Thu Jan 01 00:00:05 1970 +0000
288 288 summary: Adding c branch
289 289
290 290 changeset: 5:d8cbc61dbaa6
291 291 branch: a
292 292 parent: 2:881fe2b92ad0
293 293 user: test
294 294 date: Thu Jan 01 00:00:04 1970 +0000
295 295 summary: Adding b branch head 2
296 296
297 297 changeset: 0:19709c5a4e75
298 298 user: test
299 299 date: Thu Jan 01 00:00:00 1970 +0000
300 300 summary: Adding root node
301 301
302 302 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
303 303 $ hg branches -a
304 304 b 8:eebb944467c9
305 305 a branch name much longer than the default justification used by branches 7:10ff5895aa57
306 306 $ hg up -C b
307 307 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 308 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
309 309 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
310 310 abort: current revision is already a branch closing head
311 311 [10]
312 312
313 313 $ echo foo > b
314 314 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
315 315
316 316 $ echo bar > b
317 317 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' bh1
318 318 abort: current revision is already a branch closing head
319 319 [10]
320 320 $ hg commit -d '9 0' --close-branch -m 're-closing this branch' b
321 321
322 322 $ echo baz > b
323 323 $ hg commit -d '9 0' --close-branch -m 'empty re-closing this branch' -X b
324 324 abort: current revision is already a branch closing head
325 325 [10]
326 326 $ hg revert b
327 327
328 328 $ hg debugstrip --rev 13: --no-backup
329 329 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 330 $ hg revert --all --no-backup
331 331
332 332 $ hg log -r tip --debug
333 333 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
334 334 branch: b
335 335 tag: tip
336 336 phase: draft
337 337 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
338 338 parent: -1:0000000000000000000000000000000000000000
339 339 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
340 340 user: test
341 341 date: Thu Jan 01 00:00:09 1970 +0000
342 342 extra: branch=b
343 343 extra: close=1
344 344 description:
345 345 close this part branch too
346 346
347 347
348 348 --- b branch should be inactive
349 349
350 350 $ hg branches
351 351 a branch name much longer than the default justification used by branches 7:10ff5895aa57
352 352 c 6:589736a22561 (inactive)
353 353 a 5:d8cbc61dbaa6 (inactive)
354 354 default 0:19709c5a4e75 (inactive)
355 355 $ hg branches -c
356 356 a branch name much longer than the default justification used by branches 7:10ff5895aa57
357 357 b 12:e3d49c0575d8 (closed)
358 358 c 6:589736a22561 (inactive)
359 359 a 5:d8cbc61dbaa6 (inactive)
360 360 default 0:19709c5a4e75 (inactive)
361 361 $ hg branches -a
362 362 a branch name much longer than the default justification used by branches 7:10ff5895aa57
363 363 $ hg branches -q
364 364 a branch name much longer than the default justification used by branches
365 365 c
366 366 a
367 367 default
368 368 $ hg heads b
369 369 no open branch heads found on branches b
370 370 [1]
371 371 $ hg heads --closed b
372 372 changeset: 12:e3d49c0575d8
373 373 branch: b
374 374 tag: tip
375 375 parent: 8:eebb944467c9
376 376 user: test
377 377 date: Thu Jan 01 00:00:09 1970 +0000
378 378 summary: close this part branch too
379 379
380 380 changeset: 11:d3f163457ebf
381 381 branch: b
382 382 user: test
383 383 date: Thu Jan 01 00:00:09 1970 +0000
384 384 summary: prune bad branch
385 385
386 386 $ echo 'xxx4' >> b
387 387 $ hg commit -d '9 0' -m 'reopen branch with a change'
388 388 reopening closed branch head 12
389 389
390 390 --- branch b is back in action
391 391
392 392 $ hg branches -a
393 393 b 13:e23b5505d1ad
394 394 a branch name much longer than the default justification used by branches 7:10ff5895aa57
395 395
396 396 ---- test heads listings
397 397
398 398 $ hg heads
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 changeset: 7:10ff5895aa57
407 407 branch: a branch name much longer than the default justification used by branches
408 408 user: test
409 409 date: Thu Jan 01 00:00:06 1970 +0000
410 410 summary: Adding d branch
411 411
412 412 changeset: 6:589736a22561
413 413 branch: c
414 414 user: test
415 415 date: Thu Jan 01 00:00:05 1970 +0000
416 416 summary: Adding c branch
417 417
418 418 changeset: 5:d8cbc61dbaa6
419 419 branch: a
420 420 parent: 2:881fe2b92ad0
421 421 user: test
422 422 date: Thu Jan 01 00:00:04 1970 +0000
423 423 summary: Adding b branch head 2
424 424
425 425 changeset: 0:19709c5a4e75
426 426 user: test
427 427 date: Thu Jan 01 00:00:00 1970 +0000
428 428 summary: Adding root node
429 429
430 430
431 431 branch default
432 432
433 433 $ hg heads default
434 434 changeset: 0:19709c5a4e75
435 435 user: test
436 436 date: Thu Jan 01 00:00:00 1970 +0000
437 437 summary: Adding root node
438 438
439 439
440 440 branch a
441 441
442 442 $ hg heads a
443 443 changeset: 5:d8cbc61dbaa6
444 444 branch: a
445 445 parent: 2:881fe2b92ad0
446 446 user: test
447 447 date: Thu Jan 01 00:00:04 1970 +0000
448 448 summary: Adding b branch head 2
449 449
450 450 $ hg heads --active a
451 451 no open branch heads found on branches a
452 452 [1]
453 453
454 454 branch b
455 455
456 456 $ hg heads b
457 457 changeset: 13:e23b5505d1ad
458 458 branch: b
459 459 tag: tip
460 460 user: test
461 461 date: Thu Jan 01 00:00:09 1970 +0000
462 462 summary: reopen branch with a change
463 463
464 464 $ hg heads --closed b
465 465 changeset: 13:e23b5505d1ad
466 466 branch: b
467 467 tag: tip
468 468 user: test
469 469 date: Thu Jan 01 00:00:09 1970 +0000
470 470 summary: reopen branch with a change
471 471
472 472 changeset: 11:d3f163457ebf
473 473 branch: b
474 474 user: test
475 475 date: Thu Jan 01 00:00:09 1970 +0000
476 476 summary: prune bad branch
477 477
478 478
479 479 reclose branch
480 480
481 481 $ hg up -C c
482 482 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
483 483 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
484 484 $ hg branches
485 485 b 13:e23b5505d1ad
486 486 a branch name much longer than the default justification used by branches 7:10ff5895aa57
487 487 a 5:d8cbc61dbaa6 (inactive)
488 488 default 0:19709c5a4e75 (inactive)
489 489 $ hg branches --closed
490 490 b 13:e23b5505d1ad
491 491 a branch name much longer than the default justification used by branches 7:10ff5895aa57
492 492 c 14:f894c25619d3 (closed)
493 493 a 5:d8cbc61dbaa6 (inactive)
494 494 default 0:19709c5a4e75 (inactive)
495 495
496 496 multihead branch
497 497
498 498 $ hg up -C default
499 499 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
500 500 $ hg branch m
501 501 marked working directory as branch m
502 502 $ touch m
503 503 $ hg add m
504 504 $ hg commit -d '10 0' -m 'multihead base'
505 505 $ echo "m1" >m
506 506 $ hg commit -d '10 0' -m 'head 1'
507 507 $ hg up -C '.^'
508 508 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
509 509 $ echo "m2" >m
510 510 $ hg commit -d '10 0' -m 'head 2'
511 511 created new head
512 512 $ hg log -b m
513 513 changeset: 17:df343b0df04f
514 514 branch: m
515 515 tag: tip
516 516 parent: 15:f3447637f53e
517 517 user: test
518 518 date: Thu Jan 01 00:00:10 1970 +0000
519 519 summary: head 2
520 520
521 521 changeset: 16:a58ca5d3bdf3
522 522 branch: m
523 523 user: test
524 524 date: Thu Jan 01 00:00:10 1970 +0000
525 525 summary: head 1
526 526
527 527 changeset: 15:f3447637f53e
528 528 branch: m
529 529 parent: 0:19709c5a4e75
530 530 user: test
531 531 date: Thu Jan 01 00:00:10 1970 +0000
532 532 summary: multihead base
533 533
534 534 $ hg heads --topo m
535 535 changeset: 17:df343b0df04f
536 536 branch: m
537 537 tag: tip
538 538 parent: 15:f3447637f53e
539 539 user: test
540 540 date: Thu Jan 01 00:00:10 1970 +0000
541 541 summary: head 2
542 542
543 543 changeset: 16:a58ca5d3bdf3
544 544 branch: m
545 545 user: test
546 546 date: Thu Jan 01 00:00:10 1970 +0000
547 547 summary: head 1
548 548
549 549 $ hg branches
550 550 m 17:df343b0df04f
551 551 b 13:e23b5505d1ad
552 552 a branch name much longer than the default justification used by branches 7:10ff5895aa57
553 553 a 5:d8cbc61dbaa6 (inactive)
554 554 default 0:19709c5a4e75 (inactive)
555 555
556 556 partially merge multihead branch
557 557
558 558 $ hg up -C default
559 559 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
560 560 $ hg branch md
561 561 marked working directory as branch md
562 562 $ hg merge m
563 563 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 564 (branch merge, don't forget to commit)
565 565 $ hg commit -d '11 0' -m 'merge head 2'
566 566 $ hg heads --topo m
567 567 changeset: 16:a58ca5d3bdf3
568 568 branch: m
569 569 user: test
570 570 date: Thu Jan 01 00:00:10 1970 +0000
571 571 summary: head 1
572 572
573 573 $ hg branches
574 574 md 18:c914c99f1fbb
575 575 m 17:df343b0df04f
576 576 b 13:e23b5505d1ad
577 577 a branch name much longer than the default justification used by branches 7:10ff5895aa57
578 578 a 5:d8cbc61dbaa6 (inactive)
579 579 default 0:19709c5a4e75 (inactive)
580 580
581 581 partially close multihead branch
582 582
583 583 $ hg up -C a58ca5d3bdf3
584 584 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
585 585 $ hg commit -d '12 0' -m 'close head 1' --close-branch
586 586 $ hg heads --topo m
587 587 changeset: 19:cd21a80baa3d
588 588 branch: m
589 589 tag: tip
590 590 parent: 16:a58ca5d3bdf3
591 591 user: test
592 592 date: Thu Jan 01 00:00:12 1970 +0000
593 593 summary: close head 1
594 594
595 595 $ hg branches
596 596 md 18:c914c99f1fbb
597 597 b 13:e23b5505d1ad
598 598 a branch name much longer than the default justification used by branches 7:10ff5895aa57
599 599 m 17:df343b0df04f (inactive)
600 600 a 5:d8cbc61dbaa6 (inactive)
601 601 default 0:19709c5a4e75 (inactive)
602 602
603 603 default branch colors:
604 604
605 605 $ cat <<EOF >> $HGRCPATH
606 606 > [extensions]
607 607 > color =
608 608 > [color]
609 609 > mode = ansi
610 610 > EOF
611 611
612 612 $ hg up -C b
613 613 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 614 $ hg branches --color=always
615 615 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
616 616 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
617 617 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
618 618 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
619 619 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
620 620 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
621 621
622 622 default closed branch color:
623 623
624 624 $ hg branches --color=always --closed
625 625 \x1b[0;0mmd\x1b[0m\x1b[0;33m 18:c914c99f1fbb\x1b[0m (esc)
626 626 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
627 627 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
628 628 \x1b[0;0mm\x1b[0m\x1b[0;33m 17:df343b0df04f\x1b[0m (inactive) (esc)
629 629 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
630 630 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
631 631 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
632 632
633 633 $ cat <<EOF >> $HGRCPATH
634 634 > [extensions]
635 635 > color =
636 636 > [color]
637 637 > branches.active = green
638 638 > branches.closed = blue
639 639 > branches.current = red
640 640 > branches.inactive = magenta
641 641 > log.changeset = cyan
642 642 > EOF
643 643
644 644 custom branch colors:
645 645
646 646 $ hg branches --color=always
647 647 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
648 648 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
649 649 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
650 650 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
651 651 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
652 652 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
653 653
654 654 custom closed branch color:
655 655
656 656 $ hg branches --color=always --closed
657 657 \x1b[0;32mmd\x1b[0m\x1b[0;36m 18:c914c99f1fbb\x1b[0m (esc)
658 658 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
659 659 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
660 660 \x1b[0;35mm\x1b[0m\x1b[0;36m 17:df343b0df04f\x1b[0m (inactive) (esc)
661 661 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
662 662 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
663 663 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
664 664
665 665 template output:
666 666
667 667 $ hg branches -Tjson --closed
668 668 [
669 669 {
670 670 "active": true,
671 671 "branch": "md",
672 672 "closed": false,
673 673 "current": false,
674 674 "node": "c914c99f1fbb2b1d785a0a939ed3f67275df18e9",
675 675 "rev": 18
676 676 },
677 677 {
678 678 "active": true,
679 679 "branch": "b",
680 680 "closed": false,
681 681 "current": true,
682 682 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
683 683 "rev": 13
684 684 },
685 685 {
686 686 "active": true,
687 687 "branch": "a branch name much longer than the default justification used by branches",
688 688 "closed": false,
689 689 "current": false,
690 690 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
691 691 "rev": 7
692 692 },
693 693 {
694 694 "active": false,
695 695 "branch": "m",
696 696 "closed": false,
697 697 "current": false,
698 698 "node": "df343b0df04feb2a946cd4b6e9520e552fef14ee",
699 699 "rev": 17
700 700 },
701 701 {
702 702 "active": false,
703 703 "branch": "c",
704 704 "closed": true,
705 705 "current": false,
706 706 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
707 707 "rev": 14
708 708 },
709 709 {
710 710 "active": false,
711 711 "branch": "a",
712 712 "closed": false,
713 713 "current": false,
714 714 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
715 715 "rev": 5
716 716 },
717 717 {
718 718 "active": false,
719 719 "branch": "default",
720 720 "closed": false,
721 721 "current": false,
722 722 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
723 723 "rev": 0
724 724 }
725 725 ]
726 726
727 727 $ hg branches --closed -T '{if(closed, "{branch}\n")}'
728 728 c
729 729
730 730 $ hg branches -T '{word(0, branch)}: {desc|firstline}\n'
731 731 md: merge head 2
732 732 b: reopen branch with a change
733 733 a: Adding d branch
734 734 m: head 2
735 735 a: Adding b branch head 2
736 736 default: Adding root node
737 737
738 738 $ cat <<'EOF' > "$TESTTMP/map-myjson"
739 739 > docheader = '\{\n'
740 740 > docfooter = '\n}\n'
741 741 > separator = ',\n'
742 742 > branches = ' {dict(branch, node|short)|json}'
743 743 > EOF
744 744 $ hg branches -T "$TESTTMP/map-myjson"
745 745 {
746 746 {"branch": "md", "node": "c914c99f1fbb"},
747 747 {"branch": "b", "node": "e23b5505d1ad"},
748 748 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
749 749 {"branch": "m", "node": "df343b0df04f"},
750 750 {"branch": "a", "node": "d8cbc61dbaa6"},
751 751 {"branch": "default", "node": "19709c5a4e75"}
752 752 }
753 753
754 754 $ cat <<'EOF' >> .hg/hgrc
755 755 > [templates]
756 756 > myjson = ' {dict(branch, node|short)|json}'
757 757 > myjson:docheader = '\{\n'
758 758 > myjson:docfooter = '\n}\n'
759 759 > myjson:separator = ',\n'
760 760 > EOF
761 761 $ hg branches -T myjson
762 762 {
763 763 {"branch": "md", "node": "c914c99f1fbb"},
764 764 {"branch": "b", "node": "e23b5505d1ad"},
765 765 {"branch": "a branch *", "node": "10ff5895aa57"}, (glob)
766 766 {"branch": "m", "node": "df343b0df04f"},
767 767 {"branch": "a", "node": "d8cbc61dbaa6"},
768 768 {"branch": "default", "node": "19709c5a4e75"}
769 769 }
770 770
771 771 $ cat <<'EOF' >> .hg/hgrc
772 772 > [templates]
773 773 > :docheader = 'should not be selected as a docheader for literal templates\n'
774 774 > EOF
775 775 $ hg branches -T '{branch}\n'
776 776 md
777 777 b
778 778 a branch name much longer than the default justification used by branches
779 779 m
780 780 a
781 781 default
782 782
783 783 Tests of revision branch name caching
784 784
785 785 We rev branch cache is updated automatically. In these tests we use a trick to
786 786 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
787 787 rebuild that also will populate the rev branch cache.
788 788
789 789 revision branch cache is created when building the branch head cache
790 790 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
791 791 5
792 792 $ f --hexdump --size .hg/cache/rbc-*
793 793 .hg/cache/rbc-names-v1: size=92
794 794 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
795 795 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
796 796 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
797 797 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
798 798 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
799 799 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 |ranches.m.md|
800 800 .hg/cache/rbc-revs-v1: size=160
801 801 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
802 802 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
803 803 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
804 804 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
805 805 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
806 806 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
807 807 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
808 808 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
809 809 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
810 810 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
811 811
812 812 no errors when revbranchcache is not writable
813 813
814 814 $ echo >> .hg/cache/rbc-revs-v1
815 815 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
816 816 $ mkdir .hg/cache/rbc-revs-v1
817 817 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
818 818 5
819 819 $ rmdir .hg/cache/rbc-revs-v1
820 820 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
821 821
822 822 no errors when wlock cannot be acquired
823 823
824 824 #if unix-permissions
825 825 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
826 826 $ rm -f .hg/cache/branch*
827 827 $ chmod 555 .hg
828 828 $ hg head a -T '{rev}\n'
829 829 5
830 830 $ chmod 755 .hg
831 831 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
832 832 #endif
833 833
834 834 recovery from invalid cache revs file with trailing data
835 835 $ echo >> .hg/cache/rbc-revs-v1
836 836 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
837 837 5
838 838 truncating cache/rbc-revs-v1 to 160
839 839 $ f --size .hg/cache/rbc-revs*
840 840 .hg/cache/rbc-revs-v1: size=160
841 841
842 842 recovery from invalid cache file with partial last record
843 843 $ mv .hg/cache/rbc-revs-v1 .
844 844 $ f -qDB 119 rbc-revs-v1 > .hg/cache/rbc-revs-v1
845 845 $ f --size .hg/cache/rbc-revs*
846 846 .hg/cache/rbc-revs-v1: size=119
847 847 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
848 848 5
849 849 truncating cache/rbc-revs-v1 to 112
850 850 $ f --size .hg/cache/rbc-revs*
851 851 .hg/cache/rbc-revs-v1: size=160
852 852
853 853 recovery from invalid cache file with missing record - no truncation
854 854 $ mv .hg/cache/rbc-revs-v1 .
855 855 $ f -qDB 112 rbc-revs-v1 > .hg/cache/rbc-revs-v1
856 856 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
857 857 5
858 858 $ f --size .hg/cache/rbc-revs*
859 859 .hg/cache/rbc-revs-v1: size=160
860 860
861 861 recovery from invalid cache file with some bad records
862 862 $ mv .hg/cache/rbc-revs-v1 .
863 863 $ f -qDB 8 rbc-revs-v1 > .hg/cache/rbc-revs-v1
864 864 $ f --size .hg/cache/rbc-revs*
865 865 .hg/cache/rbc-revs-v1: size=8
866 866 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
867 867 $ f --size .hg/cache/rbc-revs*
868 868 .hg/cache/rbc-revs-v1: size=120
869 869 $ hg log -r 'branch(.)' -T '{rev} ' --debug
870 history modification detected - truncating revision branch cache to revision 13
870 history modification detected - truncating revision branch cache to revision * (glob)
871 871 history modification detected - truncating revision branch cache to revision 1
872 872 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8
873 873 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
874 874 5
875 875 truncating cache/rbc-revs-v1 to 104
876 876 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
877 877 .hg/cache/rbc-revs-v1: size=160
878 878 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
879 879
880 880 cache is updated when committing
881 881 $ hg branch i-will-regret-this
882 882 marked working directory as branch i-will-regret-this
883 883 $ hg ci -m regrets
884 884 $ f --size .hg/cache/rbc-*
885 885 .hg/cache/rbc-names-v1: size=111
886 886 .hg/cache/rbc-revs-v1: size=168
887 887
888 888 update after rollback - the cache will be correct but rbc-names will will still
889 889 contain the branch name even though it no longer is used
890 890 $ hg up -qr '.^'
891 891 $ hg rollback -qf
892 $ f --size --hexdump .hg/cache/rbc-*
892 $ f --size .hg/cache/rbc-names-*
893 893 .hg/cache/rbc-names-v1: size=111
894 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
895 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
896 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
897 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
898 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
899 0050: 72 61 6e 63 68 65 73 00 6d 00 6d 64 00 69 2d 77 |ranches.m.md.i-w|
900 0060: 69 6c 6c 2d 72 65 67 72 65 74 2d 74 68 69 73 |ill-regret-this|
894 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
895 $ f --size .hg/cache/rbc-revs-*
901 896 .hg/cache/rbc-revs-v1: size=160
902 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
903 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
904 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
905 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
906 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
907 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
908 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
909 0070: f8 94 c2 56 80 00 00 03 f3 44 76 37 00 00 00 05 |...V.....Dv7....|
910 0080: a5 8c a5 d3 00 00 00 05 df 34 3b 0d 00 00 00 05 |.........4;.....|
911 0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
912 897
913 898 cache is updated/truncated when stripping - it is thus very hard to get in a
914 899 situation where the cache is out of sync and the hash check detects it
915 900 $ hg --config extensions.strip= strip -r tip --nob
916 901 $ f --size .hg/cache/rbc-revs*
917 902 .hg/cache/rbc-revs-v1: size=152
918 903
919 904 cache is rebuilt when corruption is detected
920 905 $ echo > .hg/cache/rbc-names-v1
921 906 $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
922 907 referenced branch names not found - rebuilding revision branch cache from scratch
923 908 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40
924 $ f --size --hexdump .hg/cache/rbc-*
909 $ f --size .hg/cache/rbc-names-*
925 910 .hg/cache/rbc-names-v1: size=84
926 0000: 62 00 61 00 63 00 61 20 62 72 61 6e 63 68 20 6e |b.a.c.a branch n|
927 0010: 61 6d 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 20 |ame much longer |
928 0020: 74 68 61 6e 20 74 68 65 20 64 65 66 61 75 6c 74 |than the default|
929 0030: 20 6a 75 73 74 69 66 69 63 61 74 69 6f 6e 20 75 | justification u|
930 0040: 73 65 64 20 62 79 20 62 72 61 6e 63 68 65 73 00 |sed by branches.|
931 0050: 6d 00 6d 64 |m.md|
911 $ grep "i-will-regret-this" .hg/cache/rbc-names-* > /dev/null
912 [1]
913 $ f --size .hg/cache/rbc-revs-*
932 914 .hg/cache/rbc-revs-v1: size=152
933 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
934 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
935 0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 01 |................|
936 0030: 58 97 36 a2 00 00 00 02 10 ff 58 95 00 00 00 03 |X.6.......X.....|
937 0040: ee bb 94 44 00 00 00 00 5f 40 61 bb 00 00 00 00 |...D...._@a.....|
938 0050: bf be 84 1b 00 00 00 00 d3 f1 63 45 80 00 00 00 |..........cE....|
939 0060: e3 d4 9c 05 80 00 00 00 e2 3b 55 05 00 00 00 00 |.........;U.....|
940 0070: f8 94 c2 56 80 00 00 02 f3 44 76 37 00 00 00 04 |...V.....Dv7....|
941 0080: a5 8c a5 d3 00 00 00 04 df 34 3b 0d 00 00 00 04 |.........4;.....|
942 0090: c9 14 c9 9f 00 00 00 05 |........|
943 915
944 916 Test that cache files are created and grows correctly:
945 917
946 918 $ rm .hg/cache/rbc*
947 919 $ hg log -r "5 & branch(5)" -T "{rev}\n"
948 920 5
949 $ f --size --hexdump .hg/cache/rbc-*
921 $ f --size .hg/cache/rbc-*
950 922 .hg/cache/rbc-names-v1: size=1
951 0000: 61 |a|
952 923 .hg/cache/rbc-revs-v1: size=48
953 0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
954 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
955 0020: 00 00 00 00 00 00 00 00 d8 cb c6 1d 00 00 00 00 |................|
956 924
957 925 $ cd ..
958 926
959 927 Test for multiple incorrect branch cache entries:
960 928
961 929 $ hg init b
962 930 $ cd b
963 931 $ touch f
964 932 $ hg ci -Aqmf
965 933 $ echo >> f
966 934 $ hg ci -Amf
967 935 $ hg branch -q branch
968 936 $ hg ci -Amf
969 937
970 $ f --size --hexdump .hg/cache/rbc-*
971 .hg/cache/rbc-names-v1: size=14
972 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch|
973 .hg/cache/rbc-revs-v1: size=24
974 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
975 0010: 56 46 78 69 00 00 00 01 |VFxi....|
938 #if v2
939
940 $ f --size --sha256 .hg/cache/rbc-*
941 .hg/cache/rbc-names-v1: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
942 .hg/cache/rbc-revs-v1: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
943
976 944 $ : > .hg/cache/rbc-revs-v1
977 945
978 946 No superfluous rebuilding of cache:
979 947 $ hg log -r "branch(null)&branch(branch)" --debug
980 $ f --size --hexdump .hg/cache/rbc-*
981 .hg/cache/rbc-names-v1: size=14
982 0000: 64 65 66 61 75 6c 74 00 62 72 61 6e 63 68 |default.branch|
983 .hg/cache/rbc-revs-v1: size=24
984 0000: 66 e5 f5 aa 00 00 00 00 fa 4c 04 e5 00 00 00 00 |f........L......|
985 0010: 56 46 78 69 00 00 00 01 |VFxi....|
948 $ f --size --sha256 .hg/cache/rbc-*
949 .hg/cache/rbc-names-v1: size=14, sha256=d376f7eea9a7e28fac6470e78dae753c81a5543c9ad436e96999590e004a281c
950 .hg/cache/rbc-revs-v1: size=24, sha256=ec89032fd4e66e7282cb6e403848c681a855a9c36c6b44d19179218553b78779
951 #endif
986 952
987 953 $ cd ..
988 954
989 955 Test to make sure that `--close-branch` only works on a branch head:
990 956 --------------------------------------------------------------------
991 957 $ hg init closebranch
992 958 $ cd closebranch
993 959 $ for ch in a b c; do
994 960 > echo $ch > $ch
995 961 > hg add $ch
996 962 > hg ci -m "added "$ch
997 963 > done;
998 964
999 965 $ hg up -r "desc('added b')"
1000 966 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1001 967
1002 968 trying to close branch from a cset which is not a branch head
1003 969 it should abort:
1004 970 $ hg ci -m "closing branch" --close-branch
1005 971 abort: can only close branch heads
1006 972 (use --force-close-branch to close branch from a non-head changeset)
1007 973 [10]
1008 974
1009 975 $ hg up 0
1010 976 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1011 977 $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
1012 978 o 2: 155349b645be added c
1013 979 | default
1014 980 |
1015 981 o 1: 5f6d8a4bf34a added b
1016 982 | default
1017 983 |
1018 984 @ 0: 9092f1db7931 added a
1019 985 default
1020 986
1021 987 Test --force-close-branch to close a branch from a non-head changeset:
1022 988 ---------------------------------------------------------------------
1023 989
1024 990 $ hg show stack --config extensions.show=
1025 991 o 1553 added c
1026 992 o 5f6d added b
1027 993 @ 9092 added a
1028 994
1029 995 $ hg ci -m "branch closed" --close-branch
1030 996 abort: can only close branch heads
1031 997 (use --force-close-branch to close branch from a non-head changeset)
1032 998 [10]
1033 999
1034 1000 $ hg ci -m "branch closed" --force-close-branch
1035 1001 created new head
1036 1002 $ cd ..
1037 1003
1038 1004 Test various special cases for the branchmap
1039 1005 --------------------------------------------
1040 1006
1041 1007 Basic fork of the same branch
1042 1008
1043 1009 $ hg init branchmap-testing1
1044 1010 $ cd branchmap-testing1
1045 1011 $ hg debugbuild '@A . :base . :p1 *base /p1'
1046 1012 $ hg log -G
1047 1013 o changeset: 3:71ca9a6d524e
1048 1014 |\ branch: A
1049 1015 | | tag: tip
1050 1016 | | parent: 2:a3b807b3ff0b
1051 1017 | | parent: 1:99ba08759bc7
1052 1018 | | user: debugbuilddag
1053 1019 | | date: Thu Jan 01 00:00:03 1970 +0000
1054 1020 | | summary: r3
1055 1021 | |
1056 1022 | o changeset: 2:a3b807b3ff0b
1057 1023 | | branch: A
1058 1024 | | parent: 0:2ab8003a1750
1059 1025 | | user: debugbuilddag
1060 1026 | | date: Thu Jan 01 00:00:02 1970 +0000
1061 1027 | | summary: r2
1062 1028 | |
1063 1029 o | changeset: 1:99ba08759bc7
1064 1030 |/ branch: A
1065 1031 | tag: p1
1066 1032 | user: debugbuilddag
1067 1033 | date: Thu Jan 01 00:00:01 1970 +0000
1068 1034 | summary: r1
1069 1035 |
1070 1036 o changeset: 0:2ab8003a1750
1071 1037 branch: A
1072 1038 tag: base
1073 1039 user: debugbuilddag
1074 1040 date: Thu Jan 01 00:00:00 1970 +0000
1075 1041 summary: r0
1076 1042
1077 1043 $ hg branches
1078 1044 A 3:71ca9a6d524e
1079 1045 $ hg clone -r 1 -r 2 . ../branchmap-testing1-clone
1080 1046 adding changesets
1081 1047 adding manifests
1082 1048 adding file changes
1083 1049 added 3 changesets with 0 changes to 0 files (+1 heads)
1084 1050 new changesets 2ab8003a1750:a3b807b3ff0b
1085 1051 updating to branch A
1086 1052 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1087 1053 $ cd ../branchmap-testing1-clone
1088 1054 $ hg pull ../branchmap-testing1
1089 1055 pulling from ../branchmap-testing1
1090 1056 searching for changes
1091 1057 adding changesets
1092 1058 adding manifests
1093 1059 adding file changes
1094 1060 added 1 changesets with 0 changes to 0 files (-1 heads)
1095 1061 new changesets 71ca9a6d524e
1096 1062 (run 'hg update' to get a working copy)
1097 1063 $ hg branches
1098 1064 A 3:71ca9a6d524e
1099 1065 $ cd ..
1100 1066
1101 1067 Switching to a different branch and back
1102 1068
1103 1069 $ hg init branchmap-testing2
1104 1070 $ cd branchmap-testing2
1105 1071 $ hg debugbuild '@A . @B . @A .'
1106 1072 $ hg log -G
1107 1073 o changeset: 2:9699e9f260b5
1108 1074 | branch: A
1109 1075 | tag: tip
1110 1076 | user: debugbuilddag
1111 1077 | date: Thu Jan 01 00:00:02 1970 +0000
1112 1078 | summary: r2
1113 1079 |
1114 1080 o changeset: 1:0bc7d348d965
1115 1081 | branch: B
1116 1082 | user: debugbuilddag
1117 1083 | date: Thu Jan 01 00:00:01 1970 +0000
1118 1084 | summary: r1
1119 1085 |
1120 1086 o changeset: 0:2ab8003a1750
1121 1087 branch: A
1122 1088 user: debugbuilddag
1123 1089 date: Thu Jan 01 00:00:00 1970 +0000
1124 1090 summary: r0
1125 1091
1126 1092 $ hg branches
1127 1093 A 2:9699e9f260b5
1128 1094 B 1:0bc7d348d965 (inactive)
1129 1095 $ hg clone -r 1 . ../branchmap-testing2-clone
1130 1096 adding changesets
1131 1097 adding manifests
1132 1098 adding file changes
1133 1099 added 2 changesets with 0 changes to 0 files
1134 1100 new changesets 2ab8003a1750:0bc7d348d965
1135 1101 updating to branch B
1136 1102 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1137 1103 $ cd ../branchmap-testing2-clone
1138 1104 $ hg pull ../branchmap-testing2
1139 1105 pulling from ../branchmap-testing2
1140 1106 searching for changes
1141 1107 adding changesets
1142 1108 adding manifests
1143 1109 adding file changes
1144 1110 added 1 changesets with 0 changes to 0 files
1145 1111 new changesets 9699e9f260b5
1146 1112 (run 'hg update' to get a working copy)
1147 1113 $ hg branches
1148 1114 A 2:9699e9f260b5
1149 1115 B 1:0bc7d348d965 (inactive)
1150 1116 $ cd ..
1151 1117
1152 1118 A fork on a branch switching to a different branch and back
1153 1119 is still collecting the fork.
1154 1120
1155 1121 $ hg init branchmap-testing3
1156 1122 $ cd branchmap-testing3
1157 1123 $ hg debugbuild '@A . :base . :p1 *base @B . @A /p1'
1158 1124 $ hg log -G
1159 1125 o changeset: 4:3614a1711d23
1160 1126 |\ branch: A
1161 1127 | | tag: tip
1162 1128 | | parent: 3:e9c8abcf65aa
1163 1129 | | parent: 1:99ba08759bc7
1164 1130 | | user: debugbuilddag
1165 1131 | | date: Thu Jan 01 00:00:04 1970 +0000
1166 1132 | | summary: r4
1167 1133 | |
1168 1134 | o changeset: 3:e9c8abcf65aa
1169 1135 | | branch: B
1170 1136 | | user: debugbuilddag
1171 1137 | | date: Thu Jan 01 00:00:03 1970 +0000
1172 1138 | | summary: r3
1173 1139 | |
1174 1140 | o changeset: 2:a3b807b3ff0b
1175 1141 | | branch: A
1176 1142 | | parent: 0:2ab8003a1750
1177 1143 | | user: debugbuilddag
1178 1144 | | date: Thu Jan 01 00:00:02 1970 +0000
1179 1145 | | summary: r2
1180 1146 | |
1181 1147 o | changeset: 1:99ba08759bc7
1182 1148 |/ branch: A
1183 1149 | tag: p1
1184 1150 | user: debugbuilddag
1185 1151 | date: Thu Jan 01 00:00:01 1970 +0000
1186 1152 | summary: r1
1187 1153 |
1188 1154 o changeset: 0:2ab8003a1750
1189 1155 branch: A
1190 1156 tag: base
1191 1157 user: debugbuilddag
1192 1158 date: Thu Jan 01 00:00:00 1970 +0000
1193 1159 summary: r0
1194 1160
1195 1161 $ hg branches
1196 1162 A 4:3614a1711d23
1197 1163 B 3:e9c8abcf65aa (inactive)
1198 1164 $ hg clone -r 1 -r 3 . ../branchmap-testing3-clone
1199 1165 adding changesets
1200 1166 adding manifests
1201 1167 adding file changes
1202 1168 added 4 changesets with 0 changes to 0 files (+1 heads)
1203 1169 new changesets 2ab8003a1750:e9c8abcf65aa
1204 1170 updating to branch A
1205 1171 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1206 1172 $ cd ../branchmap-testing3-clone
1207 1173 $ hg pull ../branchmap-testing3
1208 1174 pulling from ../branchmap-testing3
1209 1175 searching for changes
1210 1176 adding changesets
1211 1177 adding manifests
1212 1178 adding file changes
1213 1179 added 1 changesets with 0 changes to 0 files (-1 heads)
1214 1180 new changesets 3614a1711d23
1215 1181 (run 'hg update' to get a working copy)
1216 1182 $ hg branches
1217 1183 A 4:3614a1711d23
1218 1184 B 3:e9c8abcf65aa (inactive)
1219 1185 $ cd ..
1220 1186
1221 1187 Intermediary parents are on different branches.
1222 1188
1223 1189 $ hg init branchmap-testing4
1224 1190 $ cd branchmap-testing4
1225 1191 $ hg debugbuild '@A . @B :base . @A :p1 *base @C . @A /p1'
1226 1192 $ hg log -G
1227 1193 o changeset: 4:4bf67499b70a
1228 1194 |\ branch: A
1229 1195 | | tag: tip
1230 1196 | | parent: 3:4a546028fa8f
1231 1197 | | parent: 1:0bc7d348d965
1232 1198 | | user: debugbuilddag
1233 1199 | | date: Thu Jan 01 00:00:04 1970 +0000
1234 1200 | | summary: r4
1235 1201 | |
1236 1202 | o changeset: 3:4a546028fa8f
1237 1203 | | branch: C
1238 1204 | | user: debugbuilddag
1239 1205 | | date: Thu Jan 01 00:00:03 1970 +0000
1240 1206 | | summary: r3
1241 1207 | |
1242 1208 | o changeset: 2:a3b807b3ff0b
1243 1209 | | branch: A
1244 1210 | | parent: 0:2ab8003a1750
1245 1211 | | user: debugbuilddag
1246 1212 | | date: Thu Jan 01 00:00:02 1970 +0000
1247 1213 | | summary: r2
1248 1214 | |
1249 1215 o | changeset: 1:0bc7d348d965
1250 1216 |/ branch: B
1251 1217 | tag: p1
1252 1218 | user: debugbuilddag
1253 1219 | date: Thu Jan 01 00:00:01 1970 +0000
1254 1220 | summary: r1
1255 1221 |
1256 1222 o changeset: 0:2ab8003a1750
1257 1223 branch: A
1258 1224 tag: base
1259 1225 user: debugbuilddag
1260 1226 date: Thu Jan 01 00:00:00 1970 +0000
1261 1227 summary: r0
1262 1228
1263 1229 $ hg branches
1264 1230 A 4:4bf67499b70a
1265 1231 C 3:4a546028fa8f (inactive)
1266 1232 B 1:0bc7d348d965 (inactive)
1267 1233 $ hg clone -r 1 -r 3 . ../branchmap-testing4-clone
1268 1234 adding changesets
1269 1235 adding manifests
1270 1236 adding file changes
1271 1237 added 4 changesets with 0 changes to 0 files (+1 heads)
1272 1238 new changesets 2ab8003a1750:4a546028fa8f
1273 1239 updating to branch B
1274 1240 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1275 1241 $ cd ../branchmap-testing4-clone
1276 1242 $ hg pull ../branchmap-testing4
1277 1243 pulling from ../branchmap-testing4
1278 1244 searching for changes
1279 1245 adding changesets
1280 1246 adding manifests
1281 1247 adding file changes
1282 1248 added 1 changesets with 0 changes to 0 files (-1 heads)
1283 1249 new changesets 4bf67499b70a
1284 1250 (run 'hg update' to get a working copy)
1285 1251 $ hg branches
1286 1252 A 4:4bf67499b70a
1287 1253 C 3:4a546028fa8f (inactive)
1288 1254 B 1:0bc7d348d965 (inactive)
1289 1255 $ cd ..
1290 1256
1291 1257 Check that the cache are not written too early
1292 1258 ----------------------------------------------
1293 1259
1294 1260 $ hg log -R branchmap-testing1 -G
1295 1261 o changeset: 3:71ca9a6d524e
1296 1262 |\ branch: A
1297 1263 | | tag: tip
1298 1264 | | parent: 2:a3b807b3ff0b
1299 1265 | | parent: 1:99ba08759bc7
1300 1266 | | user: debugbuilddag
1301 1267 | | date: Thu Jan 01 00:00:03 1970 +0000
1302 1268 | | summary: r3
1303 1269 | |
1304 1270 | o changeset: 2:a3b807b3ff0b
1305 1271 | | branch: A
1306 1272 | | parent: 0:2ab8003a1750
1307 1273 | | user: debugbuilddag
1308 1274 | | date: Thu Jan 01 00:00:02 1970 +0000
1309 1275 | | summary: r2
1310 1276 | |
1311 1277 o | changeset: 1:99ba08759bc7
1312 1278 |/ branch: A
1313 1279 | tag: p1
1314 1280 | user: debugbuilddag
1315 1281 | date: Thu Jan 01 00:00:01 1970 +0000
1316 1282 | summary: r1
1317 1283 |
1318 1284 o changeset: 0:2ab8003a1750
1319 1285 branch: A
1320 1286 tag: base
1321 1287 user: debugbuilddag
1322 1288 date: Thu Jan 01 00:00:00 1970 +0000
1323 1289 summary: r0
1324 1290
1325 1291 $ hg bundle -R branchmap-testing1 --base 1 bundle.hg --rev 'head()'
1326 1292 2 changesets found
1327 1293
1328 1294 Unbundling revision should warm the served cache
1329 1295
1330 1296 $ hg clone branchmap-testing1 --rev 1 branchmap-update-01
1331 1297 adding changesets
1332 1298 adding manifests
1333 1299 adding file changes
1334 1300 added 2 changesets with 0 changes to 0 files
1335 1301 new changesets 2ab8003a1750:99ba08759bc7
1336 1302 updating to branch A
1337 1303 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1338 1304 #if v3
1339 1305 $ cat branchmap-update-01/.hg/cache/branch3-base
1340 1306 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1
1341 1307 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1342 1308 #else
1343 1309 $ cat branchmap-update-01/.hg/cache/branch2-base
1344 1310 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1345 1311 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1346 1312 #endif
1347 1313 $ hg -R branchmap-update-01 unbundle bundle.hg
1348 1314 adding changesets
1349 1315 adding manifests
1350 1316 adding file changes
1351 1317 added 2 changesets with 0 changes to 0 files
1352 1318 new changesets a3b807b3ff0b:71ca9a6d524e (2 drafts)
1353 1319 (run 'hg update' to get a working copy)
1354 1320 #if v3
1355 1321 $ cat branchmap-update-01/.hg/cache/branch3-served
1356 1322 tip-node=71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 tip-rev=3
1357 1323 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 o A
1358 1324 #else
1359 1325 $ cat branchmap-update-01/.hg/cache/branch2-served
1360 1326 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 3
1361 1327 71ca9a6d524ed3c2a215119b2086ac3b8c4c8286 o A
1362 1328 #endif
1363 1329
1364 1330 aborted Unbundle should not update the on disk cache
1365 1331
1366 1332 $ cat >> simplehook.py << EOF
1367 1333 > import sys
1368 1334 > from mercurial import node
1369 1335 > from mercurial import branchmap
1370 1336 > def hook(ui, repo, *args, **kwargs):
1371 1337 > s = repo.filtered(b"served")
1372 1338 > s.branchmap()
1373 1339 > return 1
1374 1340 > EOF
1375 1341 $ hg clone branchmap-testing1 --rev 1 branchmap-update-02
1376 1342 adding changesets
1377 1343 adding manifests
1378 1344 adding file changes
1379 1345 added 2 changesets with 0 changes to 0 files
1380 1346 new changesets 2ab8003a1750:99ba08759bc7
1381 1347 updating to branch A
1382 1348 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1383 1349
1384 1350 #if v3
1385 1351 $ cat branchmap-update-02/.hg/cache/branch3-base
1386 1352 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1
1387 1353 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1388 1354 #else
1389 1355 $ cat branchmap-update-02/.hg/cache/branch2-base
1390 1356 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1391 1357 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1392 1358 #endif
1393 1359 $ hg -R branchmap-update-02 unbundle bundle.hg --config "hooks.pretxnclose=python:$TESTTMP/simplehook.py:hook"
1394 1360 adding changesets
1395 1361 adding manifests
1396 1362 adding file changes
1397 1363 transaction abort!
1398 1364 rollback completed
1399 1365 abort: pretxnclose hook failed
1400 1366 [40]
1401 1367 #if v3
1402 1368 $ cat branchmap-update-02/.hg/cache/branch3-base
1403 1369 tip-node=99ba08759bc7f6fdbe5304e83d0387f35c082479 tip-rev=1
1404 1370 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1405 1371 #else
1406 1372 $ cat branchmap-update-02/.hg/cache/branch2-base
1407 1373 99ba08759bc7f6fdbe5304e83d0387f35c082479 1
1408 1374 99ba08759bc7f6fdbe5304e83d0387f35c082479 o A
1409 1375 #endif
General Comments 0
You need to be logged in to leave comments. Login now