1 ============== |
1 ============== |
2 Topic Tutorial |
2 Topic Tutorial |
3 ============== |
3 ============== |
4 |
4 |
5 .. This test file is also supposed to be able to compile as a rest file. |
5 This Mercurial configuration example is used for testing. |
6 |
6 |
7 |
7 .. Various setup |
8 .. Some Setup:: |
|
9 |
8 |
10 $ . "$TESTDIR/testlib/topic_setup.sh" |
9 $ . "$TESTDIR/testlib/topic_setup.sh" |
|
10 $ cat >> $HGRCPATH << EOF |
|
11 > [experimental] |
|
12 > evolution=all |
|
13 > [extensions] |
|
14 > evolve= |
|
15 > EOF |
|
16 |
11 $ hg init server |
17 $ hg init server |
|
18 |
12 $ cd server |
19 $ cd server |
|
20 |
13 $ cat >> .hg/hgrc << EOF |
21 $ cat >> .hg/hgrc << EOF |
14 > [ui] |
22 > [ui] |
15 > user= Shopping Master |
23 > user= Shopping Master |
16 > EOF |
24 > EOF |
|
25 |
17 $ cat >> shopping << EOF |
26 $ cat >> shopping << EOF |
18 > Spam |
27 > Spam |
19 > Whizzo butter |
28 > Whizzo butter |
20 > Albatross |
29 > Albatross |
21 > Rat (rather a lot) |
30 > Rat (rather a lot) |
22 > Jugged fish |
31 > Jugged fish |
23 > Blancmange |
32 > Blancmange |
24 > Salmon mousse |
33 > Salmon mousse |
25 > EOF |
34 > EOF |
|
35 |
26 $ hg commit -A -m "Shopping list" |
36 $ hg commit -A -m "Shopping list" |
27 adding shopping |
37 adding shopping |
|
38 |
28 $ cd .. |
39 $ cd .. |
29 $ hg clone server client |
40 $ hg clone server client |
30 updating to branch default |
41 updating to branch default |
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
32 $ cd client |
43 $ cd client |
33 $ cat >> .hg/hgrc << EOF |
44 $ cat >> .hg/hgrc << EOF |
34 > [ui] |
45 > [ui] |
35 > user= Tutorial User |
46 > user= Tutorial User |
36 > EOF |
47 > EOF |
|
48 #if docgraph-ext |
|
49 $ . "$TESTDIR/testlib/docgraph_setup.sh" #rest-ignore |
|
50 #endif |
37 |
51 |
38 Topic branches are lightweight branches which disappear when changes are |
52 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 |
53 finalized (moved to the public phase). They can help users to organize and share |
40 their unfinished work. |
54 their unfinished work. |
|
55 |
|
56 In this tutorial, we explain how to use topics for local development. In the first part, |
|
57 there is a central *publishing* server. Anything pushed to the central server will become public and immutable This means no unfinished work should escapes the local repository. |
|
58 |
41 |
59 |
42 Topic Basics |
60 Topic Basics |
43 ============ |
61 ============ |
44 |
62 |
45 Let's say we use Mercurial to manage our shopping list:: |
63 Let's say we use Mercurial to manage our shopping list: |
46 |
64 |
47 $ hg log --graph |
65 $ hg log --graph |
48 @ changeset: 0:38da43f0a2ea |
66 @ changeset: 0:38da43f0a2ea |
49 tag: tip |
67 tag: tip |
50 user: test |
68 user: test |
51 date: Thu Jan 01 00:00:00 1970 +0000 |
69 date: Thu Jan 01 00:00:00 1970 +0000 |
52 summary: Shopping list |
70 summary: Shopping list |
53 |
71 |
|
72 #if docgraph-ext |
|
73 $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore |
|
74 .. graphviz:: |
|
75 |
|
76 strict digraph { |
|
77 graph [rankdir=LR, |
|
78 splines=polyline |
|
79 ]; |
|
80 node [label="\N"]; |
|
81 0 [fillcolor="#9999FF", |
|
82 fixedsize=true, |
|
83 group=default, |
|
84 height=0.5, |
|
85 label=0, |
|
86 pin=true, |
|
87 pos="1,0!", |
|
88 shape=circle, |
|
89 style=filled, |
|
90 width=0.5]; |
|
91 } |
|
92 #endif |
54 |
93 |
55 We are about to make some additions to this list and would like to do them |
94 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:: |
95 within a topic. Creating a new topic is done using the ``topic`` command: |
57 |
96 |
58 $ hg topic food |
97 $ hg topics food |
|
98 marked working directory as topic: food |
59 |
99 |
60 Much like a named branch, our topic is active but it does not contain any |
100 Much like a named branch, our topic is active but it does not contain any |
61 changesets yet:: |
101 changeset yet: |
62 |
102 |
63 $ hg topic |
103 $ hg topics |
64 * food |
104 * food |
|
105 |
65 $ hg summary |
106 $ hg summary |
66 parent: 0:38da43f0a2ea tip |
107 parent: 0:38da43f0a2ea tip |
67 Shopping list |
108 Shopping list |
68 branch: default |
109 branch: default |
69 commit: (clean) |
110 commit: (clean) |
70 update: (current) |
111 update: (current) |
71 topic: food |
112 topic: food |
|
113 |
72 $ hg log --graph |
114 $ hg log --graph |
73 @ changeset: 0:38da43f0a2ea |
115 @ changeset: 0:38da43f0a2ea |
74 tag: tip |
116 tag: tip |
75 user: test |
117 user: test |
76 date: Thu Jan 01 00:00:00 1970 +0000 |
118 date: Thu Jan 01 00:00:00 1970 +0000 |
77 summary: Shopping list |
119 summary: Shopping list |
78 |
120 |
79 |
121 |
80 Our next commit will be part of the active topic:: |
122 #if docgraph-ext |
|
123 $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore |
|
124 .. graphviz:: |
|
125 |
|
126 strict digraph { |
|
127 graph [rankdir=LR, |
|
128 splines=polyline |
|
129 ]; |
|
130 node [label="\N"]; |
|
131 0 [fillcolor="#9999FF", |
|
132 fixedsize=true, |
|
133 group=default, |
|
134 height=0.5, |
|
135 label=0, |
|
136 pin=true, |
|
137 pos="1,0!", |
|
138 shape=circle, |
|
139 style=filled, |
|
140 width=0.5]; |
|
141 } |
|
142 #endif |
|
143 |
|
144 Our next commit will be part of the active topic: |
81 |
145 |
82 $ cat >> shopping << EOF |
146 $ cat >> shopping << EOF |
83 > Egg |
147 > Egg |
84 > Suggar |
148 > Suggar |
85 > Vinegar |
149 > Vinegar |
86 > Oil |
150 > Oil |
87 > EOF |
151 > EOF |
|
152 |
88 $ hg commit -m "adding condiments" |
153 $ hg commit -m "adding condiments" |
|
154 active topic 'food' grew its first changeset |
|
155 |
89 $ hg log --graph --rev 'topic("food")' |
156 $ hg log --graph --rev 'topic("food")' |
90 @ changeset: 1:13900241408b |
157 @ changeset: 1:13900241408b |
91 | tag: tip |
158 | tag: tip |
92 ~ topic: food |
159 ~ topic: food |
93 user: test |
160 user: test |
94 date: Thu Jan 01 00:00:00 1970 +0000 |
161 date: Thu Jan 01 00:00:00 1970 +0000 |
95 summary: adding condiments |
162 summary: adding condiments |
96 |
163 |
97 |
164 |
98 And future commits will be part of that topic too:: |
165 #if docgraph-ext |
|
166 $ hg docgraph -r "topic("food")" --sphinx-directive --rankdir LR #rest-ignore |
|
167 .. graphviz:: |
|
168 |
|
169 strict digraph { |
|
170 graph [rankdir=LR, |
|
171 splines=polyline |
|
172 ]; |
|
173 node [label="\N"]; |
|
174 1 [fillcolor="#9999FF", |
|
175 fixedsize=true, |
|
176 group=default, |
|
177 height=0.5, |
|
178 label=1, |
|
179 pin=true, |
|
180 pos="1,1!", |
|
181 shape=pentagon, |
|
182 style=filled, |
|
183 width=0.5]; |
|
184 } |
|
185 #endif |
|
186 |
|
187 And future commits will be part of that topic too: |
99 |
188 |
100 $ cat >> shopping << EOF |
189 $ cat >> shopping << EOF |
101 > Bananas |
190 > Bananas |
102 > Pear |
191 > Pear |
103 > Apple |
192 > Apple |
104 > EOF |
193 > EOF |
|
194 |
105 $ hg commit -m "adding fruits" |
195 $ hg commit -m "adding fruits" |
|
196 |
106 $ hg log --graph --rev 'topic("food")' |
197 $ hg log --graph --rev 'topic("food")' |
107 @ changeset: 2:287de11b401f |
198 @ changeset: 2:287de11b401f |
108 | tag: tip |
199 | tag: tip |
109 | topic: food |
200 | topic: food |
110 | user: test |
201 | user: test |
313 o changeset: 0:38da43f0a2ea |
620 o changeset: 0:38da43f0a2ea |
314 user: test |
621 user: test |
315 date: Thu Jan 01 00:00:00 1970 +0000 |
622 date: Thu Jan 01 00:00:00 1970 +0000 |
316 summary: Shopping list |
623 summary: Shopping list |
317 |
624 |
318 $ hg up default |
625 #if docgraph-ext |
|
626 $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore |
|
627 .. graphviz:: |
|
628 |
|
629 strict digraph { |
|
630 graph [rankdir=LR, |
|
631 splines=polyline |
|
632 ]; |
|
633 node [label="\N"]; |
|
634 0 [fillcolor="#9999FF", |
|
635 fixedsize=true, |
|
636 group=default, |
|
637 height=0.5, |
|
638 label=0, |
|
639 pin=true, |
|
640 pos="1,0!", |
|
641 shape=circle, |
|
642 style=filled, |
|
643 width=0.5]; |
|
644 3 [fillcolor="#9999FF", |
|
645 fixedsize=true, |
|
646 group=default, |
|
647 height=0.5, |
|
648 label=3, |
|
649 pin=true, |
|
650 pos="1,3!", |
|
651 shape=circle, |
|
652 style=filled, |
|
653 width=0.5]; |
|
654 0 -> 3 [arrowhead=none, |
|
655 penwidth=2.0]; |
|
656 4 [fillcolor="#9999FF", |
|
657 fixedsize=true, |
|
658 group=default, |
|
659 height=0.5, |
|
660 label=4, |
|
661 pin=true, |
|
662 pos="1,4!", |
|
663 shape=circle, |
|
664 style=filled, |
|
665 width=0.5]; |
|
666 3 -> 4 [arrowhead=none, |
|
667 penwidth=2.0]; |
|
668 5 [fillcolor="#9999FF", |
|
669 fixedsize=true, |
|
670 group=default, |
|
671 height=0.5, |
|
672 label=5, |
|
673 pin=true, |
|
674 pos="1,5!", |
|
675 shape=circle, |
|
676 style=filled, |
|
677 width=0.5]; |
|
678 4 -> 5 [arrowhead=none, |
|
679 penwidth=2.0]; |
|
680 } |
|
681 #endif |
|
682 |
|
683 If we update to the *default* head, we will leave the topic behind, |
|
684 and since it is commit-less, it will vanish. |
|
685 |
|
686 $ hg update default |
|
687 clearing empty topic "food" |
319 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
688 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
689 |
|
690 From there, the topic has been completely forgotten. |
|
691 |
|
692 $ hg topics |
|
693 |
|
694 |
|
695 Keep working within topics |
|
696 ========================== |
|
697 |
|
698 Making sure all your new local commit are made within a topic will help your |
|
699 organise your work. It is possible to ensure this through the Mercurial |
|
700 configuration. |
|
701 |
|
702 For this tutorial, we'll add the config at the repository level: |
|
703 |
|
704 $ cat << EOF >> .hg/hgrc |
|
705 > [experimental] |
|
706 > enforce-topic = yes |
|
707 > EOF |
|
708 |
|
709 You can also use `hg config --edit` to update your mercurial configuration. |
|
710 |
|
711 |
|
712 Once enforcement is turned on. New local commit will be denied if no topic is active. |
|
713 |
|
714 $ echo sickle >> shopping |
|
715 $ hg commit -m 'Adding sickle' |
|
716 abort: no active topic |
|
717 (set a current topic or use '--config experimental.enforce-topic=no' to commit without a topic) |
|
718 [255] |
|
719 |
|
720 Ok, let's clean this up and delve into multiple topics. |
|
721 |
|
722 $ hg revert . |
|
723 reverting shopping |
|
724 |
320 |
725 |
321 Working with Multiple Topics |
726 Working with Multiple Topics |
322 ============================ |
727 ============================ |
323 |
728 |
324 In the above example, topics do not bring much benefit since you only have one |
729 In the above example, topics do not bring much benefits since you only have one |
325 line of development. Topics start to be more useful when you have to work on |
730 line of development. Topics start to be more useful when you have to work on |
326 multiple features at the same time. |
731 multiple features at the same time. |
327 |
732 |
328 We might go shopping in a hardware store in the same go, so let's add some |
733 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:: |
734 tools to the shopping list within a new topic: |
330 |
735 |
331 $ hg topic tools |
736 $ hg topics tools |
|
737 marked working directory as topic: tools |
332 $ echo hammer >> shopping |
738 $ echo hammer >> shopping |
333 $ hg ci -m 'Adding hammer' |
739 $ hg commit -m 'Adding hammer' |
|
740 active topic 'tools' grew its first changeset |
|
741 |
334 $ echo saw >> shopping |
742 $ echo saw >> shopping |
335 $ hg ci -m 'Adding saw' |
743 $ hg commit -m 'Adding saw' |
|
744 |
336 $ echo drill >> shopping |
745 $ echo drill >> shopping |
337 $ hg ci -m 'Adding drill' |
746 $ hg commit -m 'Adding drill' |
338 |
747 |
339 But we are not sure we will actually go to the hardware store, so in the |
748 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 |
749 meantime, we want to extend the list with drinks. We go back to the official |
341 default branch and start a new topic:: |
750 default branch and start a new topic: |
342 |
751 |
343 $ hg up default |
752 $ hg update default |
344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
753 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
345 $ hg topic drinks |
754 |
|
755 $ hg topics drinks |
|
756 marked working directory as topic: drinks |
346 $ echo 'apple juice' >> shopping |
757 $ echo 'apple juice' >> shopping |
347 $ hg ci -m 'Adding apple juice' |
758 $ hg commit -m 'Adding apple juice' |
|
759 active topic 'drinks' grew its first changeset |
|
760 |
348 $ echo 'orange juice' >> shopping |
761 $ echo 'orange juice' >> shopping |
349 $ hg ci -m 'Adding orange juice' |
762 $ hg commit -m 'Adding orange juice' |
350 |
763 |
351 We now have two topics:: |
764 We now have two topics: |
352 |
765 |
353 $ hg topic |
766 $ hg topics |
354 * drinks |
767 * drinks |
355 tools |
768 tools |
356 |
769 |
357 The information displayed by ``hg stack`` adapts to the active topic:: |
770 The information displayed by ``hg stack`` adapts to the active topic: |
358 |
771 |
359 $ hg stack |
772 $ hg stack |
360 ### topic: drinks |
773 ### topic: drinks |
361 ### branch: default |
774 ### target: default (branch) |
362 t2@ Adding orange juice (current) |
775 t2@ Adding orange juice (current) |
363 t1: Adding apple juice |
776 t1: Adding apple juice |
364 t0^ adding fruits (base) |
777 t0^ adding fruits (base) |
365 $ hg up tools |
778 |
|
779 $ hg update tools |
366 switching to topic tools |
780 switching to topic tools |
367 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
781 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
782 |
368 $ hg stack |
783 $ hg stack |
369 ### topic: tools |
784 ### topic: tools |
370 ### branch: default |
785 ### target: default (branch) |
371 t3@ Adding drill (current) |
786 t3@ Adding drill (current) |
372 t2: Adding saw |
787 t2: Adding saw |
373 t1: Adding hammer |
788 t1: Adding hammer |
374 t0^ adding fruits (base) |
789 t0^ adding fruits (base) |
375 |
790 |
376 They are seen as independent branches by Mercurial. No rebase or merge |
791 They are seen as independent branches by Mercurial. No rebase or merge |
377 between them will be attempted by default:: |
792 between them will be attempted by default: |
378 |
793 |
379 $ hg rebase |
794 $ hg rebase |
380 nothing to rebase |
795 nothing to rebase |
381 [1] |
796 [1] |
382 |
797 |
383 .. server activity:: |
798 We simulate independant contributions to the repo with this |
|
799 activity: |
384 |
800 |
385 $ cd ../server |
801 $ cd ../server |
386 $ hg up |
802 $ hg update |
387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
803 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
388 $ mv shopping foo |
804 $ mv shopping foo |
389 $ echo 'Coat' > shopping |
805 $ echo 'Coat' > shopping |
390 $ cat foo >> shopping |
806 $ cat foo >> shopping |
391 $ hg ci -m 'add a coat' |
807 $ hg commit -m 'add a coat' |
392 $ echo 'Coat' > shopping |
808 $ echo 'Coat' > shopping |
393 $ echo 'Shoes' >> shopping |
809 $ echo 'Shoes' >> shopping |
394 $ cat foo >> shopping |
810 $ cat foo >> shopping |
395 $ rm foo |
811 $ rm foo |
396 $ hg ci -m 'add a pair of shoes' |
812 $ hg commit -m 'add a pair of shoes' |
397 $ cd ../client |
813 $ cd ../client |
398 |
814 |
399 Let's see what other people did in the meantime:: |
815 Let's discover what other people did contribute: |
400 |
816 |
401 $ hg pull |
817 $ hg pull |
402 pulling from $TESTTMP/server (glob) |
818 pulling from $TESTTMP/server (glob) |
403 searching for changes |
819 searching for changes |
404 adding changesets |
820 adding changesets |
406 adding file changes |
822 adding file changes |
407 added 2 changesets with 2 changes to 1 files (+1 heads) |
823 added 2 changesets with 2 changes to 1 files (+1 heads) |
408 (run 'hg heads' to see heads) |
824 (run 'hg heads' to see heads) |
409 |
825 |
410 There are new changes! We can simply use ``hg rebase`` to update our |
826 There are new changes! We can simply use ``hg rebase`` to update our |
411 changeset on top of the latest:: |
827 changeset on top of the latest: |
|
828 |
|
829 $ hg log -G |
|
830 o changeset: 12:fbff9bc37a43 |
|
831 | tag: tip |
|
832 | user: test |
|
833 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
834 | summary: add a pair of shoes |
|
835 | |
|
836 o changeset: 11:f2d6cacc6115 |
|
837 | parent: 5:2d50db8b5b4c |
|
838 | user: test |
|
839 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
840 | summary: add a coat |
|
841 | |
|
842 | o changeset: 10:70dfa201ed73 |
|
843 | | topic: drinks |
|
844 | | user: test |
|
845 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
846 | | summary: Adding orange juice |
|
847 | | |
|
848 | o changeset: 9:8dfa45bd5e0c |
|
849 |/ topic: drinks |
|
850 | parent: 5:2d50db8b5b4c |
|
851 | user: test |
|
852 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
853 | summary: Adding apple juice |
|
854 | |
|
855 | @ changeset: 8:34255b455dac |
|
856 | | topic: tools |
|
857 | | user: test |
|
858 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
859 | | summary: Adding drill |
|
860 | | |
|
861 | o changeset: 7:cffff85af537 |
|
862 | | topic: tools |
|
863 | | user: test |
|
864 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
865 | | summary: Adding saw |
|
866 | | |
|
867 | o changeset: 6:183984ef46d1 |
|
868 |/ topic: tools |
|
869 | user: test |
|
870 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
871 | summary: Adding hammer |
|
872 | |
|
873 o changeset: 5:2d50db8b5b4c |
|
874 | user: test |
|
875 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
876 | summary: adding fruits |
|
877 | |
|
878 o changeset: 4:4011b46eeb33 |
|
879 | user: test |
|
880 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
881 | summary: adding condiments |
|
882 | |
|
883 o changeset: 3:6104862e8b84 |
|
884 | parent: 0:38da43f0a2ea |
|
885 | user: test |
|
886 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
887 | summary: Adding clothes |
|
888 | |
|
889 o changeset: 0:38da43f0a2ea |
|
890 user: test |
|
891 date: Thu Jan 01 00:00:00 1970 +0000 |
|
892 summary: Shopping list |
|
893 |
|
894 #if docgraph-ext |
|
895 $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore |
|
896 .. graphviz:: |
|
897 |
|
898 strict digraph { |
|
899 graph [rankdir=LR, |
|
900 splines=polyline |
|
901 ]; |
|
902 node [label="\N"]; |
|
903 0 [fillcolor="#9999FF", |
|
904 fixedsize=true, |
|
905 group=default, |
|
906 height=0.5, |
|
907 label=0, |
|
908 pin=true, |
|
909 pos="1,0!", |
|
910 shape=circle, |
|
911 style=filled, |
|
912 width=0.5]; |
|
913 3 [fillcolor="#9999FF", |
|
914 fixedsize=true, |
|
915 group=default, |
|
916 height=0.5, |
|
917 label=3, |
|
918 pin=true, |
|
919 pos="1,3!", |
|
920 shape=circle, |
|
921 style=filled, |
|
922 width=0.5]; |
|
923 0 -> 3 [arrowhead=none, |
|
924 penwidth=2.0]; |
|
925 4 [fillcolor="#9999FF", |
|
926 fixedsize=true, |
|
927 group=default, |
|
928 height=0.5, |
|
929 label=4, |
|
930 pin=true, |
|
931 pos="1,4!", |
|
932 shape=circle, |
|
933 style=filled, |
|
934 width=0.5]; |
|
935 3 -> 4 [arrowhead=none, |
|
936 penwidth=2.0]; |
|
937 5 [fillcolor="#9999FF", |
|
938 fixedsize=true, |
|
939 group=default, |
|
940 height=0.5, |
|
941 label=5, |
|
942 pin=true, |
|
943 pos="1,5!", |
|
944 shape=circle, |
|
945 style=filled, |
|
946 width=0.5]; |
|
947 4 -> 5 [arrowhead=none, |
|
948 penwidth=2.0]; |
|
949 6 [fillcolor="#9999FF", |
|
950 fixedsize=true, |
|
951 group=default, |
|
952 height=0.5, |
|
953 label=6, |
|
954 pin=true, |
|
955 pos="1,6!", |
|
956 shape=pentagon, |
|
957 style=filled, |
|
958 width=0.5]; |
|
959 5 -> 6 [arrowhead=none, |
|
960 penwidth=2.0]; |
|
961 9 [fillcolor="#9999FF", |
|
962 fixedsize=true, |
|
963 group=default, |
|
964 height=0.5, |
|
965 label=9, |
|
966 pin=true, |
|
967 pos="1,9!", |
|
968 shape=pentagon, |
|
969 style=filled, |
|
970 width=0.5]; |
|
971 5 -> 9 [arrowhead=none, |
|
972 penwidth=2.0]; |
|
973 11 [fillcolor="#9999FF", |
|
974 fixedsize=true, |
|
975 group=default, |
|
976 height=0.5, |
|
977 label=11, |
|
978 pin=true, |
|
979 pos="1,11!", |
|
980 shape=circle, |
|
981 style=filled, |
|
982 width=0.5]; |
|
983 5 -> 11 [arrowhead=none, |
|
984 penwidth=2.0]; |
|
985 7 [fillcolor="#9999FF", |
|
986 fixedsize=true, |
|
987 group=default, |
|
988 height=0.5, |
|
989 label=7, |
|
990 pin=true, |
|
991 pos="1,7!", |
|
992 shape=pentagon, |
|
993 style=filled, |
|
994 width=0.5]; |
|
995 6 -> 7 [arrowhead=none, |
|
996 penwidth=2.0]; |
|
997 8 [fillcolor="#9999FF", |
|
998 fixedsize=true, |
|
999 group=default, |
|
1000 height=0.5, |
|
1001 label=8, |
|
1002 pin=true, |
|
1003 pos="1,8!", |
|
1004 shape=pentagon, |
|
1005 style=filled, |
|
1006 width=0.5]; |
|
1007 7 -> 8 [arrowhead=none, |
|
1008 penwidth=2.0]; |
|
1009 10 [fillcolor="#9999FF", |
|
1010 fixedsize=true, |
|
1011 group=default, |
|
1012 height=0.5, |
|
1013 label=10, |
|
1014 pin=true, |
|
1015 pos="1,10!", |
|
1016 shape=pentagon, |
|
1017 style=filled, |
|
1018 width=0.5]; |
|
1019 9 -> 10 [arrowhead=none, |
|
1020 penwidth=2.0]; |
|
1021 12 [fillcolor="#9999FF", |
|
1022 fixedsize=true, |
|
1023 group=default, |
|
1024 height=0.5, |
|
1025 label=12, |
|
1026 pin=true, |
|
1027 pos="1,12!", |
|
1028 shape=circle, |
|
1029 style=filled, |
|
1030 width=0.5]; |
|
1031 11 -> 12 [arrowhead=none, |
|
1032 penwidth=2.0]; |
|
1033 } |
|
1034 #endif |
412 |
1035 |
413 $ hg rebase |
1036 $ hg rebase |
414 rebasing 6:183984ef46d1 "Adding hammer" |
1037 rebasing 6:183984ef46d1 "Adding hammer" |
415 merging shopping |
1038 merging shopping |
416 switching to topic tools |
1039 switching to topic tools |
417 rebasing 7:cffff85af537 "Adding saw" |
1040 rebasing 7:cffff85af537 "Adding saw" |
418 merging shopping |
1041 merging shopping |
419 rebasing 8:34255b455dac "Adding drill" |
1042 rebasing 8:34255b455dac "Adding drill" |
420 merging shopping |
1043 merging shopping |
421 |
1044 |
422 But what about the other topic? You can use 'hg topic --verbose' to see |
1045 But what about the other topic? You can use 'hg topics --verbose' to see |
423 information about all the topics:: |
1046 information about all the topics: |
424 |
1047 |
425 $ hg topic --verbose |
1048 $ hg topics --verbose |
426 drinks (on branch: default, 2 changesets, 2 behind) |
1049 drinks (on branch: default, 2 changesets, 2 behind) |
427 * tools (on branch: default, 3 changesets) |
1050 * tools (on branch: default, 3 changesets) |
428 |
1051 |
429 The "2 behind" is telling you that there are 2 new changesets on the named |
1052 The "2 behind" is telling you that there are 2 new changesets over the base of the topic. |
430 branch of the topic. You need to merge or rebase to incorporate them. |
1053 |
431 |
1054 Pushing that topic would create a new head, and therefore will be prevented: |
432 Pushing that topic would create a new head, and therefore will be prevented:: |
|
433 |
1055 |
434 $ hg push --rev drinks |
1056 $ hg push --rev drinks |
435 pushing to $TESTTMP/server (glob) |
1057 pushing to $TESTTMP/server (glob) |
436 searching for changes |
1058 searching for changes |
437 abort: push creates new remote head 70dfa201ed73! |
1059 abort: push creates new remote head 70dfa201ed73! |
438 (merge or see 'hg help push' for details about pushing new heads) |
1060 (merge or see 'hg help push' for details about pushing new heads) |
439 [255] |
1061 [255] |
440 |
1062 |
441 |
1063 |
442 Even after a rebase, pushing all active topics at the same time will complain |
1064 Even after a rebase, pushing all active topics at the same time would publish |
443 about the multiple heads it would create on that branch:: |
1065 them to the default branch, and then mercurial would complain about the |
|
1066 multiple *public* heads it would create on that branch: |
444 |
1067 |
445 $ hg rebase -b drinks |
1068 $ hg rebase -b drinks |
446 rebasing 9:8dfa45bd5e0c "Adding apple juice" |
1069 rebasing 9:8dfa45bd5e0c "Adding apple juice" |
447 merging shopping |
1070 merging shopping |
448 switching to topic drinks |
1071 switching to topic drinks |
449 rebasing 10:70dfa201ed73 "Adding orange juice" |
1072 rebasing 10:70dfa201ed73 "Adding orange juice" |
450 merging shopping |
1073 merging shopping |
451 switching to topic tools |
1074 switching to topic tools |
|
1075 |
452 $ hg push |
1076 $ hg push |
453 pushing to $TESTTMP/server (glob) |
1077 pushing to $TESTTMP/server (glob) |
454 searching for changes |
1078 searching for changes |
455 abort: push creates new remote head 4cd7c1591a67! |
1079 abort: push creates new remote head 4cd7c1591a67! |
456 (merge or see 'hg help push' for details about pushing new heads) |
1080 (merge or see 'hg help push' for details about pushing new heads) |
457 [255] |
1081 [255] |
458 |
1082 |
459 Publishing only one of them is allowed (as long as it does not create a new |
1083 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):: |
1084 branch head as we just saw in the previous case): |
461 |
1085 |
462 $ hg push -r drinks |
1086 $ hg push -r drinks |
463 pushing to $TESTTMP/server (glob) |
1087 pushing to $TESTTMP/server (glob) |
464 searching for changes |
1088 searching for changes |
465 adding changesets |
1089 adding changesets |
467 adding file changes |
1091 adding file changes |
468 added 2 changesets with 2 changes to 1 files |
1092 added 2 changesets with 2 changes to 1 files |
469 2 new obsolescence markers |
1093 2 new obsolescence markers |
470 |
1094 |
471 The published topic has now disappeared, and the other is now marked as |
1095 The published topic has now disappeared, and the other is now marked as |
472 "behind":: |
1096 "behind": |
473 |
1097 |
474 $ hg topic --verbose |
1098 $ hg topics --verbose |
475 * tools (on branch: default, 3 changesets, 2 behind) |
1099 * tools (on branch: default, 3 changesets, 2 behind) |
|
1100 |
476 $ hg stack |
1101 $ hg stack |
477 ### topic: tools |
1102 ### topic: tools |
478 ### branch: default, 2 behind |
1103 ### target: default (branch), 2 behind |
479 t3@ Adding drill (current) |
1104 t3@ Adding drill (current) |
480 t2: Adding saw |
1105 t2: Adding saw |
481 t1: Adding hammer |
1106 t1: Adding hammer |
482 t0^ add a pair of shoes (base) |
1107 t0^ add a pair of shoes (base) |
483 |
1108 |
|
1109 Working Within Your Stack |
|
1110 =========================== |
|
1111 |
|
1112 Navigating within your stack |
|
1113 ---------------------------- |
|
1114 |
|
1115 As we saw before `stack` displays changesets on your current topic in a clean way: |
|
1116 |
|
1117 $ hg topics --verbose |
|
1118 * tools (on branch: default, 3 changesets, 2 behind) |
|
1119 |
|
1120 $ hg stack |
|
1121 ### topic: tools |
|
1122 ### target: default (branch), 2 behind |
|
1123 t3@ Adding drill (current) |
|
1124 t2: Adding saw |
|
1125 t1: Adding hammer |
|
1126 t0^ add a pair of shoes (base) |
|
1127 |
|
1128 You can navigate in your current stack with `previous` and `next`. |
|
1129 |
|
1130 `previous` will bring you back to the parent of the topic head. |
|
1131 |
|
1132 $ hg previous |
|
1133 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1134 [14] Adding saw |
|
1135 |
|
1136 $ hg stack |
|
1137 ### topic: tools |
|
1138 ### target: default (branch), 2 behind |
|
1139 t3: Adding drill |
|
1140 t2@ Adding saw (current) |
|
1141 t1: Adding hammer |
|
1142 t0^ add a pair of shoes (base) |
|
1143 |
|
1144 `next` will move you forward to the topic head. |
|
1145 |
|
1146 $ hg next |
|
1147 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1148 [15] Adding drill |
|
1149 |
|
1150 $ hg stack |
|
1151 ### topic: tools |
|
1152 ### target: default (branch), 2 behind |
|
1153 t3@ Adding drill (current) |
|
1154 t2: Adding saw |
|
1155 t1: Adding hammer |
|
1156 t0^ add a pair of shoes (base) |
|
1157 |
|
1158 You can also directly jump to a changeset within your stack with the revset `t#`. |
|
1159 |
|
1160 $ hg update t1 |
|
1161 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1162 |
|
1163 $ hg stack |
|
1164 ### topic: tools |
|
1165 ### target: default (branch), 2 behind |
|
1166 t3: Adding drill |
|
1167 t2: Adding saw |
|
1168 t1@ Adding hammer (current) |
|
1169 t0^ add a pair of shoes (base) |
|
1170 |
|
1171 Editing your work mid-stack |
|
1172 --------------------------- |
|
1173 |
|
1174 It's easy to edit your work inside your stack: |
|
1175 |
|
1176 $ hg stack |
|
1177 ### topic: tools |
|
1178 ### target: default (branch), 2 behind |
|
1179 t3: Adding drill |
|
1180 t2: Adding saw |
|
1181 t1@ Adding hammer (current) |
|
1182 t0^ add a pair of shoes (base) |
|
1183 |
|
1184 $ hg amend -m "Adding hammer to the shopping list" |
|
1185 2 new unstable changesets |
|
1186 |
|
1187 Understanding the current situation with hg log is not so easy, because |
|
1188 it shows too many things: |
|
1189 |
|
1190 $ hg log -G -r "t0::" |
|
1191 @ changeset: 18:b7509bd417f8 |
|
1192 | tag: tip |
|
1193 | topic: tools |
|
1194 | parent: 12:fbff9bc37a43 |
|
1195 | user: test |
|
1196 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1197 | summary: Adding hammer to the shopping list |
|
1198 | |
|
1199 | o changeset: 17:4cd7c1591a67 |
|
1200 | | user: test |
|
1201 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1202 | | summary: Adding orange juice |
|
1203 | | |
|
1204 | o changeset: 16:20759cb47ff8 |
|
1205 |/ parent: 12:fbff9bc37a43 |
|
1206 | user: test |
|
1207 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1208 | summary: Adding apple juice |
|
1209 | |
|
1210 | o changeset: 15:bb1e6254f532 |
|
1211 | | topic: tools |
|
1212 | | user: test |
|
1213 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1214 | | trouble: unstable |
|
1215 | | summary: Adding drill |
|
1216 | | |
|
1217 | o changeset: 14:d4f97f32f8a1 |
|
1218 | | topic: tools |
|
1219 | | user: test |
|
1220 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1221 | | trouble: unstable |
|
1222 | | summary: Adding saw |
|
1223 | | |
|
1224 | x changeset: 13:a8ab3599d53d |
|
1225 |/ topic: tools |
|
1226 | user: test |
|
1227 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1228 | summary: Adding hammer |
|
1229 | |
|
1230 o changeset: 12:fbff9bc37a43 |
|
1231 | user: test |
|
1232 ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
1233 summary: add a pair of shoes |
|
1234 |
|
1235 |
|
1236 #if docgraph-ext |
|
1237 $ hg docgraph -r "t0::" --sphinx-directive --rankdir LR #rest-ignore |
|
1238 .. graphviz:: |
|
1239 |
|
1240 strict digraph { |
|
1241 graph [rankdir=LR, |
|
1242 splines=polyline |
|
1243 ]; |
|
1244 node [label="\N"]; |
|
1245 12 [fillcolor="#9999FF", |
|
1246 fixedsize=true, |
|
1247 group=default, |
|
1248 height=0.5, |
|
1249 label=12, |
|
1250 pin=true, |
|
1251 pos="1,12!", |
|
1252 shape=circle, |
|
1253 style=filled, |
|
1254 width=0.5]; |
|
1255 13 [fillcolor="#DFDFFF", |
|
1256 fixedsize=true, |
|
1257 group=default_alt, |
|
1258 height=0.5, |
|
1259 label=13, |
|
1260 pin=true, |
|
1261 pos="2,13!", |
|
1262 shape=pentagon, |
|
1263 style="dotted, filled", |
|
1264 width=0.5]; |
|
1265 12 -> 13 [arrowhead=none, |
|
1266 penwidth=2.0]; |
|
1267 18 [fillcolor="#9999FF", |
|
1268 fixedsize=true, |
|
1269 group=default, |
|
1270 height=0.5, |
|
1271 label=18, |
|
1272 pin=true, |
|
1273 pos="1,18!", |
|
1274 shape=pentagon, |
|
1275 style=filled, |
|
1276 width=0.5]; |
|
1277 12 -> 18 [arrowhead=none, |
|
1278 penwidth=2.0]; |
|
1279 16 [fillcolor="#9999FF", |
|
1280 fixedsize=true, |
|
1281 group=default, |
|
1282 height=0.5, |
|
1283 label=16, |
|
1284 pin=true, |
|
1285 pos="1,16!", |
|
1286 shape=circle, |
|
1287 style=filled, |
|
1288 width=0.5]; |
|
1289 12 -> 16 [arrowhead=none, |
|
1290 penwidth=2.0]; |
|
1291 13 -> 18 [arrowhead=none, |
|
1292 minlen=0, |
|
1293 penwidth=2.0, |
|
1294 style=dashed]; |
|
1295 14 [fillcolor="#FF4F4F", |
|
1296 fixedsize=true, |
|
1297 group=default_alt, |
|
1298 height=0.5, |
|
1299 label=14, |
|
1300 pin=true, |
|
1301 pos="2,14!", |
|
1302 shape=pentagon, |
|
1303 style=filled, |
|
1304 width=0.5]; |
|
1305 13 -> 14 [arrowhead=none, |
|
1306 penwidth=2.0]; |
|
1307 15 [fillcolor="#FF4F4F", |
|
1308 fixedsize=true, |
|
1309 group=default_alt, |
|
1310 height=0.5, |
|
1311 label=15, |
|
1312 pin=true, |
|
1313 pos="2,15!", |
|
1314 shape=pentagon, |
|
1315 style=filled, |
|
1316 width=0.5]; |
|
1317 14 -> 15 [arrowhead=none, |
|
1318 penwidth=2.0]; |
|
1319 17 [fillcolor="#9999FF", |
|
1320 fixedsize=true, |
|
1321 group=default, |
|
1322 height=0.5, |
|
1323 label=17, |
|
1324 pin=true, |
|
1325 pos="1,17!", |
|
1326 shape=circle, |
|
1327 style=filled, |
|
1328 width=0.5]; |
|
1329 16 -> 17 [arrowhead=none, |
|
1330 penwidth=2.0]; |
|
1331 } |
|
1332 #endif |
|
1333 |
|
1334 Fortunately stack shows you a better visualization: |
|
1335 |
|
1336 $ hg stack |
|
1337 ### topic: tools |
|
1338 ### target: default (branch), 2 behind |
|
1339 t3$ Adding drill (unstable) |
|
1340 t2$ Adding saw (unstable) |
|
1341 t1@ Adding hammer to the shopping list (current) |
|
1342 t0^ add a pair of shoes (base) |
|
1343 |
|
1344 It's easy to stabilize the situation, `next` has an `--evolve` option. It will |
|
1345 do the necessary relocation of `t2` and `t3` over the new `t1` without having |
|
1346 to do that rebase by hand.: |
|
1347 |
|
1348 $ hg next --evolve |
|
1349 move:[14] Adding saw |
|
1350 atop:[18] Adding hammer to the shopping list |
|
1351 working directory now at d5c51ee5762a |
|
1352 |
|
1353 $ hg stack |
|
1354 ### topic: tools |
|
1355 ### target: default (branch), 2 behind |
|
1356 t3$ Adding drill (unstable) |
|
1357 t2@ Adding saw (current) |
|
1358 t1: Adding hammer to the shopping list |
|
1359 t0^ add a pair of shoes (base) |
|
1360 |
|
1361 One more to go: |
|
1362 |
|
1363 $ hg next --evolve |
|
1364 move:[15] Adding drill |
|
1365 atop:[19] Adding saw |
|
1366 working directory now at bae3758e46bf |
|
1367 |
|
1368 $ hg stack |
|
1369 ### topic: tools |
|
1370 ### target: default (branch), 2 behind |
|
1371 t3@ Adding drill (current) |
|
1372 t2: Adding saw |
|
1373 t1: Adding hammer to the shopping list |
|
1374 t0^ add a pair of shoes (base) |
|
1375 |
|
1376 Let's take a look at `hg log` once again: |
|
1377 |
|
1378 $ hg log -G -r "t0::" |
|
1379 @ changeset: 20:bae3758e46bf |
|
1380 | tag: tip |
|
1381 | topic: tools |
|
1382 | user: test |
|
1383 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1384 | summary: Adding drill |
|
1385 | |
|
1386 o changeset: 19:d5c51ee5762a |
|
1387 | topic: tools |
|
1388 | user: test |
|
1389 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1390 | summary: Adding saw |
|
1391 | |
|
1392 o changeset: 18:b7509bd417f8 |
|
1393 | topic: tools |
|
1394 | parent: 12:fbff9bc37a43 |
|
1395 | user: test |
|
1396 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1397 | summary: Adding hammer to the shopping list |
|
1398 | |
|
1399 | o changeset: 17:4cd7c1591a67 |
|
1400 | | user: test |
|
1401 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1402 | | summary: Adding orange juice |
|
1403 | | |
|
1404 | o changeset: 16:20759cb47ff8 |
|
1405 |/ parent: 12:fbff9bc37a43 |
|
1406 | user: test |
|
1407 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1408 | summary: Adding apple juice |
|
1409 | |
|
1410 o changeset: 12:fbff9bc37a43 |
|
1411 | user: test |
|
1412 ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
1413 summary: add a pair of shoes |
|
1414 |
|
1415 |
|
1416 #if docgraph-ext |
|
1417 $ hg docgraph -r "t0::" --sphinx-directive --rankdir LR #rest-ignore |
|
1418 .. graphviz:: |
|
1419 |
|
1420 strict digraph { |
|
1421 graph [rankdir=LR, |
|
1422 splines=polyline |
|
1423 ]; |
|
1424 node [label="\N"]; |
|
1425 12 [fillcolor="#9999FF", |
|
1426 fixedsize=true, |
|
1427 group=default, |
|
1428 height=0.5, |
|
1429 label=12, |
|
1430 pin=true, |
|
1431 pos="1,12!", |
|
1432 shape=circle, |
|
1433 style=filled, |
|
1434 width=0.5]; |
|
1435 16 [fillcolor="#9999FF", |
|
1436 fixedsize=true, |
|
1437 group=default, |
|
1438 height=0.5, |
|
1439 label=16, |
|
1440 pin=true, |
|
1441 pos="1,16!", |
|
1442 shape=circle, |
|
1443 style=filled, |
|
1444 width=0.5]; |
|
1445 12 -> 16 [arrowhead=none, |
|
1446 penwidth=2.0]; |
|
1447 18 [fillcolor="#9999FF", |
|
1448 fixedsize=true, |
|
1449 group=default, |
|
1450 height=0.5, |
|
1451 label=18, |
|
1452 pin=true, |
|
1453 pos="1,18!", |
|
1454 shape=pentagon, |
|
1455 style=filled, |
|
1456 width=0.5]; |
|
1457 12 -> 18 [arrowhead=none, |
|
1458 penwidth=2.0]; |
|
1459 17 [fillcolor="#9999FF", |
|
1460 fixedsize=true, |
|
1461 group=default, |
|
1462 height=0.5, |
|
1463 label=17, |
|
1464 pin=true, |
|
1465 pos="1,17!", |
|
1466 shape=circle, |
|
1467 style=filled, |
|
1468 width=0.5]; |
|
1469 16 -> 17 [arrowhead=none, |
|
1470 penwidth=2.0]; |
|
1471 19 [fillcolor="#9999FF", |
|
1472 fixedsize=true, |
|
1473 group=default, |
|
1474 height=0.5, |
|
1475 label=19, |
|
1476 pin=true, |
|
1477 pos="1,19!", |
|
1478 shape=pentagon, |
|
1479 style=filled, |
|
1480 width=0.5]; |
|
1481 18 -> 19 [arrowhead=none, |
|
1482 penwidth=2.0]; |
|
1483 20 [fillcolor="#9999FF", |
|
1484 fixedsize=true, |
|
1485 group=default, |
|
1486 height=0.5, |
|
1487 label=20, |
|
1488 pin=true, |
|
1489 pos="1,20!", |
|
1490 shape=pentagon, |
|
1491 style=filled, |
|
1492 width=0.5]; |
|
1493 19 -> 20 [arrowhead=none, |
|
1494 penwidth=2.0]; |
|
1495 } |
|
1496 #endif |
|
1497 Multi-headed stack |
|
1498 ------------------ |
|
1499 |
|
1500 Stack is also very helpful when you have a multi-headed stack: |
|
1501 |
|
1502 $ hg up t1 |
|
1503 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1504 |
|
1505 $ echo "nails" > new_shopping |
|
1506 $ cat shopping >> new_shopping |
|
1507 $ mv new_shopping shopping |
|
1508 |
|
1509 $ hg commit -m 'Adding nails' |
|
1510 |
|
1511 $ hg stack |
|
1512 ### topic: tools (2 heads) |
|
1513 ### target: default (branch), 2 behind |
|
1514 t4: Adding drill |
|
1515 t3: Adding saw |
|
1516 t1^ Adding hammer to the shopping list (base) |
|
1517 t2@ Adding nails (current) |
|
1518 t1: Adding hammer to the shopping list |
|
1519 t0^ add a pair of shoes (base) |
|
1520 |
|
1521 Solving this situation is easy with a topic: use merge or rebase. |
|
1522 Merge within a multi-headed stack will use the other topic head as |
|
1523 destination if the topic has two heads. But rebasing will yield a |
|
1524 completely linear history so it's what we will do. |
|
1525 |
|
1526 $ hg log -G |
|
1527 @ changeset: 21:f936c6da9d61 |
|
1528 | tag: tip |
|
1529 | topic: tools |
|
1530 | parent: 18:b7509bd417f8 |
|
1531 | user: test |
|
1532 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1533 | summary: Adding nails |
|
1534 | |
|
1535 | o changeset: 20:bae3758e46bf |
|
1536 | | topic: tools |
|
1537 | | user: test |
|
1538 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1539 | | summary: Adding drill |
|
1540 | | |
|
1541 | o changeset: 19:d5c51ee5762a |
|
1542 |/ topic: tools |
|
1543 | user: test |
|
1544 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1545 | summary: Adding saw |
|
1546 | |
|
1547 o changeset: 18:b7509bd417f8 |
|
1548 | topic: tools |
|
1549 | parent: 12:fbff9bc37a43 |
|
1550 | user: test |
|
1551 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1552 | summary: Adding hammer to the shopping list |
|
1553 | |
|
1554 | o changeset: 17:4cd7c1591a67 |
|
1555 | | user: test |
|
1556 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1557 | | summary: Adding orange juice |
|
1558 | | |
|
1559 | o changeset: 16:20759cb47ff8 |
|
1560 |/ parent: 12:fbff9bc37a43 |
|
1561 | user: test |
|
1562 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1563 | summary: Adding apple juice |
|
1564 | |
|
1565 o changeset: 12:fbff9bc37a43 |
|
1566 | user: test |
|
1567 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1568 | summary: add a pair of shoes |
|
1569 | |
|
1570 o changeset: 11:f2d6cacc6115 |
|
1571 | parent: 5:2d50db8b5b4c |
|
1572 | user: test |
|
1573 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1574 | summary: add a coat |
|
1575 | |
|
1576 o changeset: 5:2d50db8b5b4c |
|
1577 | user: test |
|
1578 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1579 | summary: adding fruits |
|
1580 | |
|
1581 o changeset: 4:4011b46eeb33 |
|
1582 | user: test |
|
1583 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1584 | summary: adding condiments |
|
1585 | |
|
1586 o changeset: 3:6104862e8b84 |
|
1587 | parent: 0:38da43f0a2ea |
|
1588 | user: test |
|
1589 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1590 | summary: Adding clothes |
|
1591 | |
|
1592 o changeset: 0:38da43f0a2ea |
|
1593 user: test |
|
1594 date: Thu Jan 01 00:00:00 1970 +0000 |
|
1595 summary: Shopping list |
|
1596 |
|
1597 |
|
1598 #if docgraph-ext |
|
1599 $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore |
|
1600 .. graphviz:: |
|
1601 |
|
1602 strict digraph { |
|
1603 graph [rankdir=LR, |
|
1604 splines=polyline |
|
1605 ]; |
|
1606 node [label="\N"]; |
|
1607 0 [fillcolor="#9999FF", |
|
1608 fixedsize=true, |
|
1609 group=default, |
|
1610 height=0.5, |
|
1611 label=0, |
|
1612 pin=true, |
|
1613 pos="1,0!", |
|
1614 shape=circle, |
|
1615 style=filled, |
|
1616 width=0.5]; |
|
1617 3 [fillcolor="#9999FF", |
|
1618 fixedsize=true, |
|
1619 group=default, |
|
1620 height=0.5, |
|
1621 label=3, |
|
1622 pin=true, |
|
1623 pos="1,3!", |
|
1624 shape=circle, |
|
1625 style=filled, |
|
1626 width=0.5]; |
|
1627 0 -> 3 [arrowhead=none, |
|
1628 penwidth=2.0]; |
|
1629 4 [fillcolor="#9999FF", |
|
1630 fixedsize=true, |
|
1631 group=default, |
|
1632 height=0.5, |
|
1633 label=4, |
|
1634 pin=true, |
|
1635 pos="1,4!", |
|
1636 shape=circle, |
|
1637 style=filled, |
|
1638 width=0.5]; |
|
1639 3 -> 4 [arrowhead=none, |
|
1640 penwidth=2.0]; |
|
1641 5 [fillcolor="#9999FF", |
|
1642 fixedsize=true, |
|
1643 group=default, |
|
1644 height=0.5, |
|
1645 label=5, |
|
1646 pin=true, |
|
1647 pos="1,5!", |
|
1648 shape=circle, |
|
1649 style=filled, |
|
1650 width=0.5]; |
|
1651 4 -> 5 [arrowhead=none, |
|
1652 penwidth=2.0]; |
|
1653 11 [fillcolor="#9999FF", |
|
1654 fixedsize=true, |
|
1655 group=default, |
|
1656 height=0.5, |
|
1657 label=11, |
|
1658 pin=true, |
|
1659 pos="1,11!", |
|
1660 shape=circle, |
|
1661 style=filled, |
|
1662 width=0.5]; |
|
1663 5 -> 11 [arrowhead=none, |
|
1664 penwidth=2.0]; |
|
1665 12 [fillcolor="#9999FF", |
|
1666 fixedsize=true, |
|
1667 group=default, |
|
1668 height=0.5, |
|
1669 label=12, |
|
1670 pin=true, |
|
1671 pos="1,12!", |
|
1672 shape=circle, |
|
1673 style=filled, |
|
1674 width=0.5]; |
|
1675 11 -> 12 [arrowhead=none, |
|
1676 penwidth=2.0]; |
|
1677 16 [fillcolor="#9999FF", |
|
1678 fixedsize=true, |
|
1679 group=default, |
|
1680 height=0.5, |
|
1681 label=16, |
|
1682 pin=true, |
|
1683 pos="1,16!", |
|
1684 shape=circle, |
|
1685 style=filled, |
|
1686 width=0.5]; |
|
1687 12 -> 16 [arrowhead=none, |
|
1688 penwidth=2.0]; |
|
1689 18 [fillcolor="#9999FF", |
|
1690 fixedsize=true, |
|
1691 group=default, |
|
1692 height=0.5, |
|
1693 label=18, |
|
1694 pin=true, |
|
1695 pos="1,18!", |
|
1696 shape=pentagon, |
|
1697 style=filled, |
|
1698 width=0.5]; |
|
1699 12 -> 18 [arrowhead=none, |
|
1700 penwidth=2.0]; |
|
1701 17 [fillcolor="#9999FF", |
|
1702 fixedsize=true, |
|
1703 group=default, |
|
1704 height=0.5, |
|
1705 label=17, |
|
1706 pin=true, |
|
1707 pos="1,17!", |
|
1708 shape=circle, |
|
1709 style=filled, |
|
1710 width=0.5]; |
|
1711 16 -> 17 [arrowhead=none, |
|
1712 penwidth=2.0]; |
|
1713 19 [fillcolor="#9999FF", |
|
1714 fixedsize=true, |
|
1715 group=default, |
|
1716 height=0.5, |
|
1717 label=19, |
|
1718 pin=true, |
|
1719 pos="1,19!", |
|
1720 shape=pentagon, |
|
1721 style=filled, |
|
1722 width=0.5]; |
|
1723 18 -> 19 [arrowhead=none, |
|
1724 penwidth=2.0]; |
|
1725 21 [fillcolor="#9999FF", |
|
1726 fixedsize=true, |
|
1727 group=default, |
|
1728 height=0.5, |
|
1729 label=21, |
|
1730 pin=true, |
|
1731 pos="1,21!", |
|
1732 shape=pentagon, |
|
1733 style=filled, |
|
1734 width=0.5]; |
|
1735 18 -> 21 [arrowhead=none, |
|
1736 penwidth=2.0]; |
|
1737 20 [fillcolor="#9999FF", |
|
1738 fixedsize=true, |
|
1739 group=default, |
|
1740 height=0.5, |
|
1741 label=20, |
|
1742 pin=true, |
|
1743 pos="1,20!", |
|
1744 shape=pentagon, |
|
1745 style=filled, |
|
1746 width=0.5]; |
|
1747 19 -> 20 [arrowhead=none, |
|
1748 penwidth=2.0]; |
|
1749 } |
|
1750 #endif |
|
1751 |
|
1752 $ hg up t4 |
|
1753 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1754 |
|
1755 $ hg rebase |
|
1756 rebasing 19:d5c51ee5762a "Adding saw" |
|
1757 merging shopping |
|
1758 rebasing 20:bae3758e46bf "Adding drill" |
|
1759 merging shopping |
|
1760 |
|
1761 $ hg stack |
|
1762 ### topic: tools |
|
1763 ### target: default (branch), 2 behind |
|
1764 t4@ Adding drill (current) |
|
1765 t3: Adding saw |
|
1766 t2: Adding nails |
|
1767 t1: Adding hammer to the shopping list |
|
1768 t0^ add a pair of shoes (base) |
|
1769 |
|
1770 Collaborating through a non-publishing server |
|
1771 ============================================= |
|
1772 |
|
1773 .. setup: |
|
1774 |
|
1775 .. Let's create a non-publishing server: |
|
1776 |
|
1777 $ cd .. |
|
1778 |
|
1779 $ hg clone server non-publishing-server |
|
1780 updating to branch default |
|
1781 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1782 |
|
1783 $ cd non-publishing-server |
|
1784 $ cat >> .hg/hgrc << EOF |
|
1785 > [phases] |
|
1786 > publish = false |
|
1787 > EOF |
|
1788 |
|
1789 .. And another client: |
|
1790 |
|
1791 $ cd .. |
|
1792 |
|
1793 $ hg clone server other-client |
|
1794 updating to branch default |
|
1795 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1796 |
|
1797 $ cd client |
|
1798 |
|
1799 We can now share these draft changesets: |
|
1800 |
|
1801 $ hg push ../non-publishing-server -r tools |
|
1802 pushing to ../non-publishing-server |
|
1803 searching for changes |
|
1804 adding changesets |
|
1805 adding manifests |
|
1806 adding file changes |
|
1807 added 4 changesets with 4 changes to 1 files (+1 heads) |
|
1808 8 new obsolescence markers |
|
1809 |
|
1810 Pushing the new topic branch to a non publishing server did not require |
|
1811 --force. As long as new heads are on their own topic, Mercurial will not |
|
1812 complain about them. |
|
1813 |
|
1814 From another client, we will get them with their topic: |
|
1815 |
|
1816 $ cd ../other-client |
|
1817 |
|
1818 $ hg pull ../non-publishing-server |
|
1819 pulling from ../non-publishing-server |
|
1820 searching for changes |
|
1821 adding changesets |
|
1822 adding manifests |
|
1823 adding file changes |
|
1824 added 4 changesets with 4 changes to 1 files (+1 heads) |
|
1825 8 new obsolescence markers |
|
1826 (run 'hg heads' to see heads) |
|
1827 |
|
1828 $ hg topics --verbose |
|
1829 tools (on branch: default, 4 changesets, 2 behind) |
|
1830 |
|
1831 $ hg up tools |
|
1832 switching to topic tools |
|
1833 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1834 |
|
1835 $ hg stack |
|
1836 ### topic: tools |
|
1837 ### target: default (branch), 2 behind |
|
1838 t4@ Adding drill (current) |
|
1839 t3: Adding saw |
|
1840 t2: Adding nails |
|
1841 t1: Adding hammer to the shopping list |
|
1842 t0^ add a pair of shoes (base) |
|
1843 |
|
1844 We can also add new changesets and share them: |
|
1845 |
|
1846 $ echo screws >> shopping |
|
1847 |
|
1848 $ hg commit -A -m "Adding screws" |
|
1849 |
|
1850 $ hg push ../non-publishing-server |
|
1851 pushing to ../non-publishing-server |
|
1852 searching for changes |
|
1853 adding changesets |
|
1854 adding manifests |
|
1855 adding file changes |
|
1856 added 1 changesets with 1 changes to 1 files |
|
1857 |
|
1858 And retrieve them on the first client: |
|
1859 |
|
1860 $ cd ../client |
|
1861 |
|
1862 $ hg pull ../non-publishing-server |
|
1863 pulling from ../non-publishing-server |
|
1864 searching for changes |
|
1865 adding changesets |
|
1866 adding manifests |
|
1867 adding file changes |
|
1868 added 1 changesets with 1 changes to 1 files |
|
1869 (run 'hg update' to get a working copy) |
|
1870 |
|
1871 $ hg update |
|
1872 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1873 |
|
1874 $ hg stack |
|
1875 ### topic: tools |
|
1876 ### target: default (branch), 2 behind |
|
1877 t5@ Adding screws (current) |
|
1878 t4: Adding drill |
|
1879 t3: Adding saw |
|
1880 t2: Adding nails |
|
1881 t1: Adding hammer to the shopping list |
|
1882 t0^ add a pair of shoes (base) |