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