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