34 > [ui] |
45 > [ui] |
35 > user= Tutorial User |
46 > user= Tutorial User |
36 > EOF |
47 > EOF |
37 |
48 |
38 Topic branches are lightweight branches which disappear when changes are |
49 Topic branches are lightweight branches which disappear when changes are |
39 finalized (move to the public phase). They can help users to organise and share |
50 finalized (move to the public phase). They can help users to organize and share |
40 their unfinished work. |
51 their unfinished work. |
41 |
52 |
42 Topic Basics |
53 Topic Basics |
43 ============ |
54 ============ |
44 |
55 |
45 Let's say we use Mercurial to manage our shopping list:: |
56 Let's say we use Mercurial to manage our shopping list: |
46 |
57 |
47 $ hg log --graph |
58 $ hg log --graph |
48 @ changeset: 0:38da43f0a2ea |
59 @ changeset: 0:38da43f0a2ea |
49 tag: tip |
60 tag: tip |
50 user: test |
61 user: test |
51 date: Thu Jan 01 00:00:00 1970 +0000 |
62 date: Thu Jan 01 00:00:00 1970 +0000 |
52 summary: Shopping list |
63 summary: Shopping list |
53 |
64 |
54 |
65 |
55 We are about to make some additions to this list and would like to do them |
66 We are about to make some additions to this list and would like to do them |
56 within a topic. Creating a new topic is done using the ``topic`` command:: |
67 within a topic. Creating a new topic is done using the ``topic`` command: |
57 |
68 |
58 $ hg topic food |
69 $ hg topic food |
59 |
70 |
60 Much like a named branch, our topic is active but it does not contain any |
71 Much like a named branch, our topic is active but it does not contain any |
61 changesets yet:: |
72 changesets yet: |
62 |
73 |
63 $ hg topic |
74 $ hg topic |
64 * food |
75 * food |
|
76 |
65 $ hg summary |
77 $ hg summary |
66 parent: 0:38da43f0a2ea tip |
78 parent: 0:38da43f0a2ea tip |
67 Shopping list |
79 Shopping list |
68 branch: default |
80 branch: default |
69 commit: (clean) |
81 commit: (clean) |
70 update: (current) |
82 update: (current) |
71 topic: food |
83 topic: food |
|
84 |
72 $ hg log --graph |
85 $ hg log --graph |
73 @ changeset: 0:38da43f0a2ea |
86 @ changeset: 0:38da43f0a2ea |
74 tag: tip |
87 tag: tip |
75 user: test |
88 user: test |
76 date: Thu Jan 01 00:00:00 1970 +0000 |
89 date: Thu Jan 01 00:00:00 1970 +0000 |
77 summary: Shopping list |
90 summary: Shopping list |
78 |
91 |
79 |
92 |
80 Our next commit will be part of the active topic:: |
93 Our next commit will be part of the active topic: |
81 |
94 |
82 $ cat >> shopping << EOF |
95 $ cat >> shopping << EOF |
83 > Egg |
96 > Egg |
84 > Suggar |
97 > Suggar |
85 > Vinegar |
98 > Vinegar |
86 > Oil |
99 > Oil |
87 > EOF |
100 > EOF |
|
101 |
88 $ hg commit -m "adding condiments" |
102 $ hg commit -m "adding condiments" |
|
103 |
89 $ hg log --graph --rev 'topic("food")' |
104 $ hg log --graph --rev 'topic("food")' |
90 @ changeset: 1:13900241408b |
105 @ changeset: 1:13900241408b |
91 | tag: tip |
106 | tag: tip |
92 ~ topic: food |
107 ~ topic: food |
93 user: test |
108 user: test |
94 date: Thu Jan 01 00:00:00 1970 +0000 |
109 date: Thu Jan 01 00:00:00 1970 +0000 |
95 summary: adding condiments |
110 summary: adding condiments |
96 |
111 |
97 |
112 |
98 And future commits will be part of that topic too:: |
113 And future commits will be part of that topic too: |
99 |
114 |
100 $ cat >> shopping << EOF |
115 $ cat >> shopping << EOF |
101 > Bananas |
116 > Bananas |
102 > Pear |
117 > Pear |
103 > Apple |
118 > Apple |
104 > EOF |
119 > EOF |
|
120 |
105 $ hg commit -m "adding fruits" |
121 $ hg commit -m "adding fruits" |
|
122 |
106 $ hg log --graph --rev 'topic("food")' |
123 $ hg log --graph --rev 'topic("food")' |
107 @ changeset: 2:287de11b401f |
124 @ changeset: 2:287de11b401f |
108 | tag: tip |
125 | tag: tip |
109 | topic: food |
126 | topic: food |
110 | user: test |
127 | user: test |
313 o changeset: 0:38da43f0a2ea |
342 o changeset: 0:38da43f0a2ea |
314 user: test |
343 user: test |
315 date: Thu Jan 01 00:00:00 1970 +0000 |
344 date: Thu Jan 01 00:00:00 1970 +0000 |
316 summary: Shopping list |
345 summary: Shopping list |
317 |
346 |
318 $ hg up default |
347 $ hg update default |
319 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
348 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
320 |
349 |
321 Working with Multiple Topics |
350 Working with Multiple Topics |
322 ============================ |
351 ============================ |
323 |
352 |
324 In the above example, topics do not bring much benefit since you only have one |
353 In the above example, topics do not bring much benefit since you only have one |
325 line of development. Topics start to be more useful when you have to work on |
354 line of development. Topics start to be more useful when you have to work on |
326 multiple features at the same time. |
355 multiple features at the same time. |
327 |
356 |
328 We might go shopping in a hardware store in the same go, so let's add some |
357 We might go shopping in a hardware store in the same go, so let's add some |
329 tools to the shopping list within a new topic:: |
358 tools to the shopping list within a new topic: |
330 |
359 |
331 $ hg topic tools |
360 $ hg topic tools |
332 $ echo hammer >> shopping |
361 $ echo hammer >> shopping |
333 $ hg ci -m 'Adding hammer' |
362 $ hg commit -m 'Adding hammer' |
|
363 |
334 $ echo saw >> shopping |
364 $ echo saw >> shopping |
335 $ hg ci -m 'Adding saw' |
365 $ hg commit -m 'Adding saw' |
|
366 |
336 $ echo drill >> shopping |
367 $ echo drill >> shopping |
337 $ hg ci -m 'Adding drill' |
368 $ hg commit -m 'Adding drill' |
338 |
369 |
339 But we are not sure we will actually go to the hardware store, so in the |
370 But we are not sure we will actually go to the hardware store, so in the |
340 meantime, we want to extend the list with drinks. We go back to the official |
371 meantime, we want to extend the list with drinks. We go back to the official |
341 default branch and start a new topic:: |
372 default branch and start a new topic: |
342 |
373 |
343 $ hg up default |
374 $ hg update default |
344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
375 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
376 |
345 $ hg topic drinks |
377 $ hg topic drinks |
346 $ echo 'apple juice' >> shopping |
378 $ echo 'apple juice' >> shopping |
347 $ hg ci -m 'Adding apple juice' |
379 $ hg commit -m 'Adding apple juice' |
|
380 |
348 $ echo 'orange juice' >> shopping |
381 $ echo 'orange juice' >> shopping |
349 $ hg ci -m 'Adding orange juice' |
382 $ hg commit -m 'Adding orange juice' |
350 |
383 |
351 We now have two topics:: |
384 We now have two topics: |
352 |
385 |
353 $ hg topic |
386 $ hg topic |
354 * drinks |
387 * drinks |
355 tools |
388 tools |
356 |
389 |
357 The information displayed by ``hg stack`` adapts to the active topic:: |
390 The information displayed by ``hg stack`` adapts to the active topic: |
358 |
391 |
359 $ hg stack |
392 $ hg stack |
360 ### topic: drinks |
393 ### topic: drinks |
361 ### branch: default |
394 ### branch: default |
362 t2@ Adding orange juice (current) |
395 t2@ Adding orange juice (current) |
363 t1: Adding apple juice |
396 t1: Adding apple juice |
364 t0^ adding fruits (base) |
397 t0^ adding fruits (base) |
365 $ hg up tools |
398 |
|
399 $ hg update tools |
366 switching to topic tools |
400 switching to topic tools |
367 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
401 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
402 |
368 $ hg stack |
403 $ hg stack |
369 ### topic: tools |
404 ### topic: tools |
370 ### branch: default |
405 ### branch: default |
371 t3@ Adding drill (current) |
406 t3@ Adding drill (current) |
372 t2: Adding saw |
407 t2: Adding saw |
373 t1: Adding hammer |
408 t1: Adding hammer |
374 t0^ adding fruits (base) |
409 t0^ adding fruits (base) |
375 |
410 |
376 They are seen as independent branches by Mercurial. No rebase or merge |
411 They are seen as independent branches by Mercurial. No rebase or merge |
377 between them will be attempted by default:: |
412 between them will be attempted by default: |
378 |
413 |
379 $ hg rebase |
414 $ hg rebase |
380 nothing to rebase |
415 nothing to rebase |
381 [1] |
416 [1] |
382 |
417 |
383 .. server activity:: |
418 Server activity: |
384 |
419 |
385 $ cd ../server |
420 $ cd ../server |
386 $ hg up |
421 $ hg update |
387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
422 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
388 $ mv shopping foo |
423 $ mv shopping foo |
389 $ echo 'Coat' > shopping |
424 $ echo 'Coat' > shopping |
390 $ cat foo >> shopping |
425 $ cat foo >> shopping |
391 $ hg ci -m 'add a coat' |
426 $ hg commit -m 'add a coat' |
392 $ echo 'Coat' > shopping |
427 $ echo 'Coat' > shopping |
393 $ echo 'Shoes' >> shopping |
428 $ echo 'Shoes' >> shopping |
394 $ cat foo >> shopping |
429 $ cat foo >> shopping |
395 $ rm foo |
430 $ rm foo |
396 $ hg ci -m 'add a pair of shoes' |
431 $ hg commit -m 'add a pair of shoes' |
397 $ cd ../client |
432 $ cd ../client |
398 |
433 |
399 Let's see what other people did in the meantime:: |
434 Let's see what other people did in the meantime: |
400 |
435 |
401 $ hg pull |
436 $ hg pull |
402 pulling from $TESTTMP/server (glob) |
437 pulling from $TESTTMP/server (glob) |
403 searching for changes |
438 searching for changes |
404 adding changesets |
439 adding changesets |
406 adding file changes |
441 adding file changes |
407 added 2 changesets with 2 changes to 1 files (+1 heads) |
442 added 2 changesets with 2 changes to 1 files (+1 heads) |
408 (run 'hg heads' to see heads) |
443 (run 'hg heads' to see heads) |
409 |
444 |
410 There are new changes! We can simply use ``hg rebase`` to update our |
445 There are new changes! We can simply use ``hg rebase`` to update our |
411 changeset on top of the latest:: |
446 changeset on top of the latest: |
412 |
447 |
|
448 $ hg log -G |
|
449 o changeset: 12:fbff9bc37a43 |
|
450 | tag: tip |
|
451 | user: test |
|
452 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
453 | summary: add a pair of shoes |
|
454 | |
|
455 o changeset: 11:f2d6cacc6115 |
|
456 | parent: 5:2d50db8b5b4c |
|
457 | user: test |
|
458 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
459 | summary: add a coat |
|
460 | |
|
461 | o changeset: 10:70dfa201ed73 |
|
462 | | topic: drinks |
|
463 | | user: test |
|
464 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
465 | | summary: Adding orange juice |
|
466 | | |
|
467 | o changeset: 9:8dfa45bd5e0c |
|
468 |/ topic: drinks |
|
469 | parent: 5:2d50db8b5b4c |
|
470 | user: test |
|
471 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
472 | summary: Adding apple juice |
|
473 | |
|
474 | @ changeset: 8:34255b455dac |
|
475 | | topic: tools |
|
476 | | user: test |
|
477 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
478 | | summary: Adding drill |
|
479 | | |
|
480 | o changeset: 7:cffff85af537 |
|
481 | | topic: tools |
|
482 | | user: test |
|
483 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
484 | | summary: Adding saw |
|
485 | | |
|
486 | o changeset: 6:183984ef46d1 |
|
487 |/ topic: tools |
|
488 | user: test |
|
489 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
490 | summary: Adding hammer |
|
491 | |
|
492 o changeset: 5:2d50db8b5b4c |
|
493 | user: test |
|
494 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
495 | summary: adding fruits |
|
496 | |
|
497 o changeset: 4:4011b46eeb33 |
|
498 | user: test |
|
499 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
500 | summary: adding condiments |
|
501 | |
|
502 o changeset: 3:6104862e8b84 |
|
503 | parent: 0:38da43f0a2ea |
|
504 | user: test |
|
505 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
506 | summary: Adding clothes |
|
507 | |
|
508 o changeset: 0:38da43f0a2ea |
|
509 user: test |
|
510 date: Thu Jan 01 00:00:00 1970 +0000 |
|
511 summary: Shopping list |
|
512 |
413 $ hg rebase |
513 $ hg rebase |
414 rebasing 6:183984ef46d1 "Adding hammer" |
514 rebasing 6:183984ef46d1 "Adding hammer" |
415 merging shopping |
515 merging shopping |
416 switching to topic tools |
516 switching to topic tools |
417 rebasing 7:cffff85af537 "Adding saw" |
517 rebasing 7:cffff85af537 "Adding saw" |
418 merging shopping |
518 merging shopping |
419 rebasing 8:34255b455dac "Adding drill" |
519 rebasing 8:34255b455dac "Adding drill" |
420 merging shopping |
520 merging shopping |
421 |
521 |
422 But what about the other topic? You can use 'hg topic --verbose' to see |
522 But what about the other topic? You can use 'hg topic --verbose' to see |
423 information about all the topics:: |
523 information about all the topics: |
424 |
524 |
425 $ hg topic --verbose |
525 $ hg topic --verbose |
426 drinks (on branch: default, 2 changesets, 2 behind) |
526 drinks (on branch: default, 2 changesets, 2 behind) |
427 * tools (on branch: default, 3 changesets) |
527 * tools (on branch: default, 3 changesets) |
428 |
528 |
429 The "2 behind" is telling you that there are 2 new changesets on the named |
529 The "2 behind" is telling you that there are 2 new changesets on the named |
430 branch of the topic. You need to merge or rebase to incorporate them. |
530 branch of the topic. You need to merge or rebase to incorporate them. |
431 |
531 |
432 Pushing that topic would create a new head, and therefore will be prevented:: |
532 Pushing that topic would create a new head, and therefore will be prevented: |
433 |
533 |
434 $ hg push --rev drinks |
534 $ hg push --rev drinks |
435 pushing to $TESTTMP/server (glob) |
535 pushing to $TESTTMP/server (glob) |
436 searching for changes |
536 searching for changes |
437 abort: push creates new remote head 70dfa201ed73! |
537 abort: push creates new remote head 70dfa201ed73! |
438 (merge or see 'hg help push' for details about pushing new heads) |
538 (merge or see 'hg help push' for details about pushing new heads) |
439 [255] |
539 [255] |
440 |
540 |
441 |
541 |
442 Even after a rebase, pushing all active topics at the same time will complain |
542 Even after a rebase, pushing all active topics at the same time will complain |
443 about the multiple heads it would create on that branch:: |
543 about the multiple heads it would create on that branch: |
444 |
544 |
445 $ hg rebase -b drinks |
545 $ hg rebase -b drinks |
446 rebasing 9:8dfa45bd5e0c "Adding apple juice" |
546 rebasing 9:8dfa45bd5e0c "Adding apple juice" |
447 merging shopping |
547 merging shopping |
448 switching to topic drinks |
548 switching to topic drinks |
449 rebasing 10:70dfa201ed73 "Adding orange juice" |
549 rebasing 10:70dfa201ed73 "Adding orange juice" |
450 merging shopping |
550 merging shopping |
451 switching to topic tools |
551 switching to topic tools |
|
552 |
452 $ hg push |
553 $ hg push |
453 pushing to $TESTTMP/server (glob) |
554 pushing to $TESTTMP/server (glob) |
454 searching for changes |
555 searching for changes |
455 abort: push creates new remote head 4cd7c1591a67! |
556 abort: push creates new remote head 4cd7c1591a67! |
456 (merge or see 'hg help push' for details about pushing new heads) |
557 (merge or see 'hg help push' for details about pushing new heads) |
457 [255] |
558 [255] |
458 |
559 |
459 Publishing only one of them is allowed (as long as it does not create a new |
560 Publishing only one of them is allowed (as long as it does not create a new |
460 branch head as we just saw in the previous case):: |
561 branch head as we just saw in the previous case): |
461 |
562 |
462 $ hg push -r drinks |
563 $ hg push -r drinks |
463 pushing to $TESTTMP/server (glob) |
564 pushing to $TESTTMP/server (glob) |
464 searching for changes |
565 searching for changes |
465 adding changesets |
566 adding changesets |
467 adding file changes |
568 adding file changes |
468 added 2 changesets with 2 changes to 1 files |
569 added 2 changesets with 2 changes to 1 files |
469 2 new obsolescence markers |
570 2 new obsolescence markers |
470 |
571 |
471 The published topic has now disappeared, and the other is now marked as |
572 The published topic has now disappeared, and the other is now marked as |
472 "behind":: |
573 "behind": |
473 |
574 |
474 $ hg topic --verbose |
575 $ hg topic --verbose |
475 * tools (on branch: default, 3 changesets, 2 behind) |
576 * tools (on branch: default, 3 changesets, 2 behind) |
|
577 |
476 $ hg stack |
578 $ hg stack |
477 ### topic: tools |
579 ### topic: tools |
478 ### branch: default, 2 behind |
580 ### branch: default, 2 behind |
479 t3@ Adding drill (current) |
581 t3@ Adding drill (current) |
480 t2: Adding saw |
582 t2: Adding saw |
481 t1: Adding hammer |
583 t1: Adding hammer |
482 t0^ add a pair of shoes (base) |
584 t0^ add a pair of shoes (base) |
483 |
585 |
|
586 Working Within Your Stack |
|
587 =========================== |
|
588 |
|
589 Navigating within your stack |
|
590 ---------------------------- |
|
591 |
|
592 As we saw before `stack` display changesets on your current topic in a clean way: |
|
593 |
|
594 $ hg topics --verbose |
|
595 * tools (on branch: default, 3 changesets, 2 behind) |
|
596 |
|
597 $ hg stack |
|
598 ### topic: tools |
|
599 ### branch: default, 2 behind |
|
600 t3@ Adding drill (current) |
|
601 t2: Adding saw |
|
602 t1: Adding hammer |
|
603 t0^ add a pair of shoes (base) |
|
604 |
|
605 You can navigate in your current stack with `previous` and `next`. |
|
606 |
|
607 `previous` will takes you to the parent of your working directory parent on the same topic. |
|
608 |
|
609 $ hg previous |
|
610 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
611 [14] Adding saw |
|
612 |
|
613 $ hg stack |
|
614 ### topic: tools |
|
615 ### branch: default, 2 behind |
|
616 t3: Adding drill |
|
617 t2@ Adding saw (current) |
|
618 t1: Adding hammer |
|
619 t0^ add a pair of shoes (base) |
|
620 |
|
621 `next` will moves take you to the children of your working directory parent on the same topic. |
|
622 |
|
623 $ hg next |
|
624 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
625 [15] Adding drill |
|
626 |
|
627 $ hg stack |
|
628 ### topic: tools |
|
629 ### branch: default, 2 behind |
|
630 t3@ Adding drill (current) |
|
631 t2: Adding saw |
|
632 t1: Adding hammer |
|
633 t0^ add a pair of shoes (base) |
|
634 |
|
635 You can also directly access changesets within your stack with the revset `t#`. |
|
636 |
|
637 $ hg update t1 |
|
638 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
639 |
|
640 $ hg stack |
|
641 ### topic: tools |
|
642 ### branch: default, 2 behind |
|
643 t3: Adding drill |
|
644 t2: Adding saw |
|
645 t1@ Adding hammer (current) |
|
646 t0^ add a pair of shoes (base) |
|
647 |
|
648 Editing your work mid-stack |
|
649 --------------------------- |
|
650 |
|
651 It's easy to edit your work inside your stack: |
|
652 |
|
653 $ hg stack |
|
654 ### topic: tools |
|
655 ### branch: default, 2 behind |
|
656 t3: Adding drill |
|
657 t2: Adding saw |
|
658 t1@ Adding hammer (current) |
|
659 t0^ add a pair of shoes (base) |
|
660 |
|
661 $ hg amend -m "Adding hammer to the shopping list" |
|
662 2 new unstable changesets |
|
663 |
|
664 Understanding the current situation with hg log is not so easy: |
|
665 |
|
666 $ hg log -G -r "t0::" |
|
667 @ changeset: 18:b7509bd417f8 |
|
668 | tag: tip |
|
669 | topic: tools |
|
670 | parent: 12:fbff9bc37a43 |
|
671 | user: test |
|
672 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
673 | summary: Adding hammer to the shopping list |
|
674 | |
|
675 | o changeset: 17:4cd7c1591a67 |
|
676 | | user: test |
|
677 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
678 | | summary: Adding orange juice |
|
679 | | |
|
680 | o changeset: 16:20759cb47ff8 |
|
681 |/ parent: 12:fbff9bc37a43 |
|
682 | user: test |
|
683 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
684 | summary: Adding apple juice |
|
685 | |
|
686 | o changeset: 15:bb1e6254f532 |
|
687 | | topic: tools |
|
688 | | user: test |
|
689 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
690 | | trouble: unstable |
|
691 | | summary: Adding drill |
|
692 | | |
|
693 | o changeset: 14:d4f97f32f8a1 |
|
694 | | topic: tools |
|
695 | | user: test |
|
696 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
697 | | trouble: unstable |
|
698 | | summary: Adding saw |
|
699 | | |
|
700 | x changeset: 13:a8ab3599d53d |
|
701 |/ topic: tools |
|
702 | user: test |
|
703 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
704 | obsolete: rewritten as b7509bd417f8 |
|
705 | summary: Adding hammer |
|
706 | |
|
707 o changeset: 12:fbff9bc37a43 |
|
708 | user: test |
|
709 ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
710 summary: add a pair of shoes |
|
711 |
|
712 Fortunately stack show you a better visualization: |
|
713 |
|
714 $ hg stack |
|
715 ### topic: tools |
|
716 ### branch: default, 2 behind |
|
717 t3$ Adding drill (unstable) |
|
718 t2$ Adding saw (unstable) |
|
719 t1@ Adding hammer to the shopping list (current) |
|
720 t0^ add a pair of shoes (base) |
|
721 |
|
722 It's easy to stabilize the situation, `next` has an `--evolve` option: |
|
723 |
|
724 $ hg next --evolve |
|
725 move:[14] Adding saw |
|
726 atop:[18] Adding hammer to the shopping list |
|
727 working directory now at d5c51ee5762a |
|
728 |
|
729 $ hg stack |
|
730 ### topic: tools |
|
731 ### branch: default, 2 behind |
|
732 t3$ Adding drill (unstable) |
|
733 t2@ Adding saw (current) |
|
734 t1: Adding hammer to the shopping list |
|
735 t0^ add a pair of shoes (base) |
|
736 |
|
737 One more to go: |
|
738 |
|
739 $ hg next --evolve |
|
740 move:[15] Adding drill |
|
741 atop:[19] Adding saw |
|
742 working directory now at bae3758e46bf |
|
743 |
|
744 $ hg stack |
|
745 ### topic: tools |
|
746 ### branch: default, 2 behind |
|
747 t3@ Adding drill (current) |
|
748 t2: Adding saw |
|
749 t1: Adding hammer to the shopping list |
|
750 t0^ add a pair of shoes (base) |
|
751 |
|
752 Let's take a look at `hg log` once again: |
|
753 |
|
754 $ hg log -G -r "t0::" |
|
755 @ changeset: 20:bae3758e46bf |
|
756 | tag: tip |
|
757 | topic: tools |
|
758 | user: test |
|
759 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
760 | summary: Adding drill |
|
761 | |
|
762 o changeset: 19:d5c51ee5762a |
|
763 | topic: tools |
|
764 | user: test |
|
765 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
766 | summary: Adding saw |
|
767 | |
|
768 o changeset: 18:b7509bd417f8 |
|
769 | topic: tools |
|
770 | parent: 12:fbff9bc37a43 |
|
771 | user: test |
|
772 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
773 | summary: Adding hammer to the shopping list |
|
774 | |
|
775 | o changeset: 17:4cd7c1591a67 |
|
776 | | user: test |
|
777 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
778 | | summary: Adding orange juice |
|
779 | | |
|
780 | o changeset: 16:20759cb47ff8 |
|
781 |/ parent: 12:fbff9bc37a43 |
|
782 | user: test |
|
783 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
784 | summary: Adding apple juice |
|
785 | |
|
786 o changeset: 12:fbff9bc37a43 |
|
787 | user: test |
|
788 ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
789 summary: add a pair of shoes |
|
790 |
|
791 Multi-headed stack |
|
792 ------------------ |
|
793 |
|
794 Stack is also very helpful when you have a multi-headed stack: |
|
795 |
|
796 $ hg up t1 |
|
797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
798 |
|
799 $ echo "nails" > new_shopping |
|
800 $ cat shopping >> new_shopping |
|
801 $ mv new_shopping shopping |
|
802 |
|
803 $ hg commit -m 'Adding nails' |
|
804 |
|
805 $ hg stack |
|
806 ### topic: tools (2 heads) |
|
807 ### branch: default, 2 behind |
|
808 t4: Adding drill |
|
809 t3: Adding saw |
|
810 t1^ Adding hammer to the shopping list (base) |
|
811 t2@ Adding nails (current) |
|
812 t1: Adding hammer to the shopping list |
|
813 t0^ add a pair of shoes (base) |
|
814 |
|
815 Solving this situation is easy with a topic, use merge or rebase. |
|
816 Merge within a multi-headed stack will use the other topic head as |
|
817 redestination if the topic has multiple heads. |
|
818 |
|
819 $ hg log -G |
|
820 @ changeset: 21:f936c6da9d61 |
|
821 | tag: tip |
|
822 | topic: tools |
|
823 | parent: 18:b7509bd417f8 |
|
824 | user: test |
|
825 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
826 | summary: Adding nails |
|
827 | |
|
828 | o changeset: 20:bae3758e46bf |
|
829 | | topic: tools |
|
830 | | user: test |
|
831 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
832 | | summary: Adding drill |
|
833 | | |
|
834 | o changeset: 19:d5c51ee5762a |
|
835 |/ topic: tools |
|
836 | user: test |
|
837 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
838 | summary: Adding saw |
|
839 | |
|
840 o changeset: 18:b7509bd417f8 |
|
841 | topic: tools |
|
842 | parent: 12:fbff9bc37a43 |
|
843 | user: test |
|
844 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
845 | summary: Adding hammer to the shopping list |
|
846 | |
|
847 | o changeset: 17:4cd7c1591a67 |
|
848 | | user: test |
|
849 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
850 | | summary: Adding orange juice |
|
851 | | |
|
852 | o changeset: 16:20759cb47ff8 |
|
853 |/ parent: 12:fbff9bc37a43 |
|
854 | user: test |
|
855 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
856 | summary: Adding apple juice |
|
857 | |
|
858 o changeset: 12:fbff9bc37a43 |
|
859 | user: test |
|
860 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
861 | summary: add a pair of shoes |
|
862 | |
|
863 o changeset: 11:f2d6cacc6115 |
|
864 | parent: 5:2d50db8b5b4c |
|
865 | user: test |
|
866 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
867 | summary: add a coat |
|
868 | |
|
869 o changeset: 5:2d50db8b5b4c |
|
870 | user: test |
|
871 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
872 | summary: adding fruits |
|
873 | |
|
874 o changeset: 4:4011b46eeb33 |
|
875 | user: test |
|
876 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
877 | summary: adding condiments |
|
878 | |
|
879 o changeset: 3:6104862e8b84 |
|
880 | parent: 0:38da43f0a2ea |
|
881 | user: test |
|
882 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
883 | summary: Adding clothes |
|
884 | |
|
885 o changeset: 0:38da43f0a2ea |
|
886 user: test |
|
887 date: Thu Jan 01 00:00:00 1970 +0000 |
|
888 summary: Shopping list |
|
889 |
|
890 |
|
891 $ hg up t4 |
|
892 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
893 |
|
894 $ hg rebase |
|
895 rebasing 19:d5c51ee5762a "Adding saw" |
|
896 merging shopping |
|
897 rebasing 20:bae3758e46bf "Adding drill" |
|
898 merging shopping |
|
899 |
|
900 $ hg commit -m "Merge tools" |
|
901 nothing changed |
|
902 [1] |
|
903 |
|
904 $ hg stack |
|
905 ### topic: tools |
|
906 ### branch: default, 2 behind |
|
907 t4@ Adding drill (current) |
|
908 t3: Adding saw |
|
909 t2: Adding nails |
|
910 t1: Adding hammer to the shopping list |
|
911 t0^ add a pair of shoes (base) |
|
912 |
|
913 Collaborating through non-publishing server |
|
914 =========================================== |
|
915 |
|
916 .. setup: |
|
917 |
|
918 .. Let's create a non-publishing server: |
|
919 |
|
920 $ cd .. |
|
921 |
|
922 $ hg clone server non-publishing-server |
|
923 updating to branch default |
|
924 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
925 |
|
926 $ cd non-publishing-server |
|
927 $ cat >> .hg/hgrc << EOF |
|
928 > [phases] |
|
929 > publish = false |
|
930 > EOF |
|
931 |
|
932 .. And another client: |
|
933 |
|
934 $ cd .. |
|
935 |
|
936 $ hg clone server other-client |
|
937 updating to branch default |
|
938 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
939 |
|
940 $ cd client |
|
941 |
|
942 We can now share theses drafts changesets: |
|
943 |
|
944 $ hg push ../non-publishing-server -r tools |
|
945 pushing to ../non-publishing-server |
|
946 searching for changes |
|
947 adding changesets |
|
948 adding manifests |
|
949 adding file changes |
|
950 added 4 changesets with 4 changes to 1 files (+1 heads) |
|
951 8 new obsolescence markers |
|
952 |
|
953 Pushing the new topic branch to a non publishing server did not required |
|
954 --force. As long as new heads are on their own topic, Mercurial will not |
|
955 complains about them. |
|
956 |
|
957 From another client, we will gets them with their topic: |
|
958 |
|
959 $ cd ../other-client |
|
960 |
|
961 $ hg pull ../non-publishing-server |
|
962 pulling from ../non-publishing-server |
|
963 searching for changes |
|
964 adding changesets |
|
965 adding manifests |
|
966 adding file changes |
|
967 added 4 changesets with 4 changes to 1 files (+1 heads) |
|
968 8 new obsolescence markers |
|
969 (run 'hg heads' to see heads) |
|
970 |
|
971 $ hg topics --verbose |
|
972 tools (on branch: default, 4 changesets, 2 behind) |
|
973 |
|
974 $ hg up tools |
|
975 switching to topic tools |
|
976 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
977 |
|
978 $ hg stack |
|
979 ### topic: tools |
|
980 ### branch: default, 2 behind |
|
981 t4@ Adding drill (current) |
|
982 t3: Adding saw |
|
983 t2: Adding nails |
|
984 t1: Adding hammer to the shopping list |
|
985 t0^ add a pair of shoes (base) |
|
986 |
|
987 We can also add new changesets and share them: |
|
988 |
|
989 $ echo screws >> shopping |
|
990 |
|
991 $ hg commit -A -m "Adding screws" |
|
992 |
|
993 $ hg push ../non-publishing-server |
|
994 pushing to ../non-publishing-server |
|
995 searching for changes |
|
996 adding changesets |
|
997 adding manifests |
|
998 adding file changes |
|
999 added 1 changesets with 1 changes to 1 files |
|
1000 |
|
1001 And retrieve them on the first client: |
|
1002 |
|
1003 $ cd ../client |
|
1004 |
|
1005 $ hg pull ../non-publishing-server |
|
1006 pulling from ../non-publishing-server |
|
1007 searching for changes |
|
1008 adding changesets |
|
1009 adding manifests |
|
1010 adding file changes |
|
1011 added 1 changesets with 1 changes to 1 files |
|
1012 (run 'hg update' to get a working copy) |
|
1013 |
|
1014 $ hg update |
|
1015 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1016 |
|
1017 $ hg stack |
|
1018 ### topic: tools |
|
1019 ### branch: default, 2 behind |
|
1020 t5@ Adding screws (current) |
|
1021 t4: Adding drill |
|
1022 t3: Adding saw |
|
1023 t2: Adding nails |
|
1024 t1: Adding hammer to the shopping list |
|
1025 t0^ add a pair of shoes (base) |