comparison tests/test-topic-tutorial.t @ 6919:6859ed744625 mercurial-5.1

test-compat: merge mercurial-5.2 into mercurial-5.1
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 25 Oct 2024 17:55:54 +0400
parents b1d010b2e6c4 8da51e02b5d3
children
comparison
equal deleted inserted replaced
6814:c203bc3114bb 6919:6859ed744625
4 4
5 This Mercurial configuration example is used for testing. 5 This Mercurial configuration example is used for testing.
6 6
7 .. Various setup 7 .. Various setup
8 8
9 $ . "$TESTDIR/testlib/topic_setup.sh" 9 $ . "$TESTDIR/testlib/common.sh" #rest-ignore
10 $ cat >> $HGRCPATH << EOF 10 $ cat >> $HGRCPATH << EOF
11 > [experimental]
12 > evolution=all
13 > [extensions] 11 > [extensions]
14 > evolve= 12 > evolve =
13 > rebase =
14 > topic =
15 > EOF 15 > EOF
16 16
17 $ hg init server 17 $ hg init server
18 18
19 $ cd server 19 $ cd server
20 20
21 $ cat >> .hg/hgrc << EOF 21 $ cat >> .hg/hgrc << EOF
22 > [ui] 22 > [ui]
23 > user= Shopping Master 23 > user = Shopping Master
24 > EOF 24 > EOF
25 25
26 $ cat >> shopping << EOF 26 $ cat >> shopping << EOF
27 > Spam 27 > Spam
28 > Whizzo butter 28 > Whizzo butter
41 updating to branch default 41 updating to branch default
42 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
43 $ cd client 43 $ cd client
44 $ cat >> .hg/hgrc << EOF 44 $ cat >> .hg/hgrc << EOF
45 > [ui] 45 > [ui]
46 > user= Tutorial User 46 > user = Tutorial User
47 > EOF 47 > EOF
48 #if docgraph-ext 48 #if docgraph-ext
49 $ . "$TESTDIR/testlib/docgraph_setup.sh" #rest-ignore 49 $ . "$TESTDIR/testlib/docgraph_setup.sh" #rest-ignore
50 #endif 50 #endif
51 51
98 98
99 $ hg topics food 99 $ hg topics food
100 marked working directory as topic: food 100 marked working directory as topic: food
101 101
102 Much like a named branch, our topic is active but it does not contain any 102 Much like a named branch, our topic is active but it does not contain any
103 changeset yet: 103 changesets yet:
104 104
105 $ hg topics 105 $ hg topics
106 * food (0 changesets) 106 * food (0 changesets)
107 107
108 $ hg summary 108 $ hg summary
145 145
146 Our next commit will be part of the active topic: 146 Our next commit will be part of the active topic:
147 147
148 $ cat >> shopping << EOF 148 $ cat >> shopping << EOF
149 > Egg 149 > Egg
150 > Suggar 150 > Sugar
151 > Vinegar 151 > Vinegar
152 > Oil 152 > Oil
153 > EOF 153 > EOF
154 154
155 $ hg commit -m "adding condiments" 155 $ hg commit -m "adding condiments"
156 active topic 'food' grew its first changeset 156 active topic 'food' grew its first changeset
157 (see 'hg help topics' for more information) 157 (see 'hg help topics' for more information)
158 158
159 $ hg log --graph --rev 'topic("food")' 159 $ hg log --graph --rev 'topic("food")'
160 @ changeset: 1:13900241408b 160 @ changeset: 1:9e90e00c084b
161 | tag: tip 161 | tag: tip
162 ~ topic: food 162 ~ topic: food
163 user: test 163 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000 164 date: Thu Jan 01 00:00:00 1970 +0000
165 summary: adding condiments 165 summary: adding condiments
196 > EOF 196 > EOF
197 197
198 $ hg commit -m "adding fruits" 198 $ hg commit -m "adding fruits"
199 199
200 $ hg log --graph --rev 'topic("food")' 200 $ hg log --graph --rev 'topic("food")'
201 @ changeset: 2:287de11b401f 201 @ changeset: 2:a25aaa6b9385
202 | tag: tip 202 | tag: tip
203 | topic: food 203 | topic: food
204 | user: test 204 | user: test
205 | date: Thu Jan 01 00:00:00 1970 +0000 205 | date: Thu Jan 01 00:00:00 1970 +0000
206 | summary: adding fruits 206 | summary: adding fruits
207 | 207 |
208 o changeset: 1:13900241408b 208 o changeset: 1:9e90e00c084b
209 | topic: food 209 | topic: food
210 ~ user: test 210 ~ user: test
211 date: Thu Jan 01 00:00:00 1970 +0000 211 date: Thu Jan 01 00:00:00 1970 +0000
212 summary: adding condiments 212 summary: adding condiments
213 213
266 266
267 Note that ``default`` (name of the branch) now refers to the tipmost 267 Note that ``default`` (name of the branch) now refers to the tipmost
268 changeset of default without a topic: 268 changeset of default without a topic:
269 269
270 $ hg log --graph 270 $ hg log --graph
271 o changeset: 2:287de11b401f 271 o changeset: 2:a25aaa6b9385
272 | tag: tip 272 | tag: tip
273 | topic: food 273 | topic: food
274 | user: test 274 | user: test
275 | date: Thu Jan 01 00:00:00 1970 +0000 275 | date: Thu Jan 01 00:00:00 1970 +0000
276 | summary: adding fruits 276 | summary: adding fruits
277 | 277 |
278 o changeset: 1:13900241408b 278 o changeset: 1:9e90e00c084b
279 | topic: food 279 | topic: food
280 | user: test 280 | user: test
281 | date: Thu Jan 01 00:00:00 1970 +0000 281 | date: Thu Jan 01 00:00:00 1970 +0000
282 | summary: adding condiments 282 | summary: adding condiments
283 | 283 |
393 | parent: 0:38da43f0a2ea 393 | parent: 0:38da43f0a2ea
394 | user: test 394 | user: test
395 | date: Thu Jan 01 00:00:00 1970 +0000 395 | date: Thu Jan 01 00:00:00 1970 +0000
396 | summary: Adding clothes 396 | summary: Adding clothes
397 | 397 |
398 | o changeset: 2:287de11b401f 398 | o changeset: 2:a25aaa6b9385
399 | | topic: food 399 | | topic: food
400 | | user: test 400 | | user: test
401 | | date: Thu Jan 01 00:00:00 1970 +0000 401 | | date: Thu Jan 01 00:00:00 1970 +0000
402 | | summary: adding fruits 402 | | summary: adding fruits
403 | | 403 | |
404 | @ changeset: 1:13900241408b 404 | @ changeset: 1:9e90e00c084b
405 |/ topic: food 405 |/ topic: food
406 | user: test 406 | user: test
407 | date: Thu Jan 01 00:00:00 1970 +0000 407 | date: Thu Jan 01 00:00:00 1970 +0000
408 | summary: adding condiments 408 | summary: adding condiments
409 | 409 |
486 $ hg update food 486 $ hg update food
487 switching to topic food 487 switching to topic food
488 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 488 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 489
490 $ hg rebase 490 $ hg rebase
491 rebasing 1:13900241408b "adding condiments" (food) 491 rebasing 1:9e90e00c084b "adding condiments" (food)
492 merging shopping 492 merging shopping
493 switching to topic food 493 switching to topic food
494 rebasing 2:287de11b401f "adding fruits" (food) 494 rebasing 2:a25aaa6b9385 "adding fruits" (food)
495 merging shopping 495 merging shopping
496 496
497 $ hg log --graph 497 $ hg log --graph
498 @ changeset: 5:2d50db8b5b4c 498 @ changeset: 5:fec062fcfcfa
499 | tag: tip 499 | tag: tip
500 | topic: food 500 | topic: food
501 | user: test 501 | user: test
502 | date: Thu Jan 01 00:00:00 1970 +0000 502 | date: Thu Jan 01 00:00:00 1970 +0000
503 | summary: adding fruits 503 | summary: adding fruits
504 | 504 |
505 o changeset: 4:4011b46eeb33 505 o changeset: 4:d3a1ea2a0337
506 | topic: food 506 | topic: food
507 | user: test 507 | user: test
508 | date: Thu Jan 01 00:00:00 1970 +0000 508 | date: Thu Jan 01 00:00:00 1970 +0000
509 | summary: adding condiments 509 | summary: adding condiments
510 | 510 |
578 #endif 578 #endif
579 579
580 There exists a template keyword named "topic" which can be used 580 There exists a template keyword named "topic" which can be used
581 581
582 $ hg log -GT "{rev}:{node|short} {topic}\n {desc}" 582 $ hg log -GT "{rev}:{node|short} {topic}\n {desc}"
583 @ 5:2d50db8b5b4c food 583 @ 5:fec062fcfcfa food
584 | adding fruits 584 | adding fruits
585 o 4:4011b46eeb33 food 585 o 4:d3a1ea2a0337 food
586 | adding condiments 586 | adding condiments
587 o 3:6104862e8b84 587 o 3:6104862e8b84
588 | Adding clothes 588 | Adding clothes
589 o 0:38da43f0a2ea 589 o 0:38da43f0a2ea
590 Shopping list 590 Shopping list
616 ### target: default (branch) 616 ### target: default (branch)
617 (stack is empty) 617 (stack is empty)
618 s0^ adding fruits (base current) 618 s0^ adding fruits (base current)
619 619
620 $ hg log --graph 620 $ hg log --graph
621 @ changeset: 5:2d50db8b5b4c 621 @ changeset: 5:fec062fcfcfa
622 | tag: tip 622 | tag: tip
623 | user: test 623 | user: test
624 | date: Thu Jan 01 00:00:00 1970 +0000 624 | date: Thu Jan 01 00:00:00 1970 +0000
625 | summary: adding fruits 625 | summary: adding fruits
626 | 626 |
627 o changeset: 4:4011b46eeb33 627 o changeset: 4:d3a1ea2a0337
628 | user: test 628 | user: test
629 | date: Thu Jan 01 00:00:00 1970 +0000 629 | date: Thu Jan 01 00:00:00 1970 +0000
630 | summary: adding condiments 630 | summary: adding condiments
631 | 631 |
632 o changeset: 3:6104862e8b84 632 o changeset: 3:6104862e8b84
711 711
712 712
713 Keep working within topics 713 Keep working within topics
714 ========================== 714 ==========================
715 715
716 Making sure all your new local commit are made within a topic will help you 716 Making sure all your new local commits are made within a topic will help you
717 organize your work. It is possible to ensure this through the Mercurial 717 organize your work. It is possible to ensure this through the Mercurial
718 configuration. 718 configuration.
719 719
720 For this tutorial, we'll add the config at the repository level: 720 For this tutorial, we'll add the config at the repository level:
721 721
722 $ cat << EOF >> .hg/hgrc 722 $ cat << EOF >> .hg/hgrc
723 > [experimental] 723 > [experimental]
724 > topic-mode = enforce 724 > topic-mode = enforce
725 > EOF 725 > EOF
726 726
727 You can also use `hg config --edit` to update your mercurial configuration. 727 You can also use `hg config --edit` to update your Mercurial configuration.
728 728
729 729
730 Once enforcement is turned on. New local commit will be denied if no topic is active. 730 Once enforcement is turned on, new local commits will be denied if no topic is active.
731 731
732 $ echo sickle >> shopping 732 $ echo sickle >> shopping
733 $ hg commit -m 'Adding sickle' 733 $ hg commit -m 'Adding sickle'
734 abort: no active topic 734 abort: no active topic
735 (see 'hg help -e topic.topic-mode' for details) 735 (see 'hg help -e topic.topic-mode' for details)
762 $ hg commit -m 'Adding saw' 762 $ hg commit -m 'Adding saw'
763 763
764 $ echo drill >> shopping 764 $ echo drill >> shopping
765 $ hg commit -m 'Adding drill' 765 $ hg commit -m 'Adding drill'
766 766
767 But we are not sure we will actually go to the hardware store, so in the 767 But we are not sure if we will actually go to the hardware store, so in the
768 meantime, we want to extend the list with drinks. We go back to the official 768 meantime, we want to extend the list with drinks. We go back to the official
769 default branch and start a new topic: 769 default branch and start a new topic:
770 770
771 $ hg update default 771 $ hg update default
772 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 772 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
813 813
814 $ hg rebase 814 $ hg rebase
815 nothing to rebase 815 nothing to rebase
816 [1] 816 [1]
817 817
818 We simulate independant contributions to the repo with this 818 We simulate independent contributions to the repo with this
819 activity: 819 activity:
820 820
821 $ cd ../server 821 $ cd ../server
822 $ hg update 822 $ hg update
823 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 823 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
830 $ cat foo >> shopping 830 $ cat foo >> shopping
831 $ rm foo 831 $ rm foo
832 $ hg commit -m 'add a pair of shoes' 832 $ hg commit -m 'add a pair of shoes'
833 $ cd ../client 833 $ cd ../client
834 834
835 Let's discover what other people did contribute: 835 Let's discover what other people have contributed:
836 836
837 $ hg pull 837 $ hg pull
838 pulling from $TESTTMP/server (glob) 838 pulling from $TESTTMP/server (glob)
839 searching for changes 839 searching for changes
840 adding changesets 840 adding changesets
841 adding manifests 841 adding manifests
842 adding file changes 842 adding file changes
843 added 2 changesets with 2 changes to 1 files (+1 heads) 843 added 2 changesets with 2 changes to 1 files (+1 heads)
844 new changesets f2d6cacc6115:fbff9bc37a43 844 new changesets bbfb218049cd:033bfcc0ecb0
845 (run 'hg heads' to see heads) 845 (run 'hg heads' to see heads)
846 846
847 There are new changes! We can simply use ``hg rebase`` to update our 847 There are new changes! We can simply use ``hg rebase`` to update our
848 changeset on top of the latest: 848 changeset on top of the latest:
849 849
850 $ hg log -G 850 $ hg log -G
851 o changeset: 12:fbff9bc37a43 851 o changeset: 12:033bfcc0ecb0
852 | tag: tip 852 | tag: tip
853 | user: test 853 | user: test
854 | date: Thu Jan 01 00:00:00 1970 +0000 854 | date: Thu Jan 01 00:00:00 1970 +0000
855 | summary: add a pair of shoes 855 | summary: add a pair of shoes
856 | 856 |
857 o changeset: 11:f2d6cacc6115 857 o changeset: 11:bbfb218049cd
858 | parent: 5:2d50db8b5b4c 858 | parent: 5:fec062fcfcfa
859 | user: test 859 | user: test
860 | date: Thu Jan 01 00:00:00 1970 +0000 860 | date: Thu Jan 01 00:00:00 1970 +0000
861 | summary: add a coat 861 | summary: add a coat
862 | 862 |
863 | o changeset: 10:70dfa201ed73 863 | o changeset: 10:0b8a99ba9213
864 | | topic: drinks 864 | | topic: drinks
865 | | user: test 865 | | user: test
866 | | date: Thu Jan 01 00:00:00 1970 +0000 866 | | date: Thu Jan 01 00:00:00 1970 +0000
867 | | summary: Adding orange juice 867 | | summary: Adding orange juice
868 | | 868 | |
869 | o changeset: 9:8dfa45bd5e0c 869 | o changeset: 9:213e97c6cd8a
870 |/ topic: drinks 870 |/ topic: drinks
871 | parent: 5:2d50db8b5b4c 871 | parent: 5:fec062fcfcfa
872 | user: test 872 | user: test
873 | date: Thu Jan 01 00:00:00 1970 +0000 873 | date: Thu Jan 01 00:00:00 1970 +0000
874 | summary: Adding apple juice 874 | summary: Adding apple juice
875 | 875 |
876 | @ changeset: 8:34255b455dac 876 | @ changeset: 8:9ef4e4f40a79
877 | | topic: tools 877 | | topic: tools
878 | | user: test 878 | | user: test
879 | | date: Thu Jan 01 00:00:00 1970 +0000 879 | | date: Thu Jan 01 00:00:00 1970 +0000
880 | | summary: Adding drill 880 | | summary: Adding drill
881 | | 881 | |
882 | o changeset: 7:cffff85af537 882 | o changeset: 7:c1d9846a234f
883 | | topic: tools 883 | | topic: tools
884 | | user: test 884 | | user: test
885 | | date: Thu Jan 01 00:00:00 1970 +0000 885 | | date: Thu Jan 01 00:00:00 1970 +0000
886 | | summary: Adding saw 886 | | summary: Adding saw
887 | | 887 | |
888 | o changeset: 6:183984ef46d1 888 | o changeset: 6:6d6f38ff45f0
889 |/ topic: tools 889 |/ topic: tools
890 | user: test 890 | user: test
891 | date: Thu Jan 01 00:00:00 1970 +0000 891 | date: Thu Jan 01 00:00:00 1970 +0000
892 | summary: Adding hammer 892 | summary: Adding hammer
893 | 893 |
894 o changeset: 5:2d50db8b5b4c 894 o changeset: 5:fec062fcfcfa
895 | user: test 895 | user: test
896 | date: Thu Jan 01 00:00:00 1970 +0000 896 | date: Thu Jan 01 00:00:00 1970 +0000
897 | summary: adding fruits 897 | summary: adding fruits
898 | 898 |
899 o changeset: 4:4011b46eeb33 899 o changeset: 4:d3a1ea2a0337
900 | user: test 900 | user: test
901 | date: Thu Jan 01 00:00:00 1970 +0000 901 | date: Thu Jan 01 00:00:00 1970 +0000
902 | summary: adding condiments 902 | summary: adding condiments
903 | 903 |
904 o changeset: 3:6104862e8b84 904 o changeset: 3:6104862e8b84
1053 penwidth=2.0]; 1053 penwidth=2.0];
1054 } 1054 }
1055 #endif 1055 #endif
1056 1056
1057 $ hg rebase 1057 $ hg rebase
1058 rebasing 6:183984ef46d1 "Adding hammer" (tools) 1058 rebasing 6:6d6f38ff45f0 "Adding hammer" (tools)
1059 merging shopping 1059 merging shopping
1060 switching to topic tools 1060 switching to topic tools
1061 rebasing 7:cffff85af537 "Adding saw" (tools) 1061 rebasing 7:c1d9846a234f "Adding saw" (tools)
1062 merging shopping 1062 merging shopping
1063 rebasing 8:34255b455dac "Adding drill" (tools) 1063 rebasing 8:9ef4e4f40a79 "Adding drill" (tools)
1064 merging shopping 1064 merging shopping
1065 1065
1066 But what about the other topic? You can use 'hg topics --verbose' to see 1066 But what about the other topic? You can use ``hg topics --verbose`` to see
1067 information about all the topics: 1067 information about all the topics:
1068 1068
1069 $ hg topics --verbose 1069 $ hg topics --verbose
1070 drinks (on branch: default, 2 changesets, 2 behind) 1070 drinks (on branch: default, 2 changesets, 2 behind)
1071 * tools (on branch: default, 3 changesets) 1071 * tools (on branch: default, 3 changesets)
1072 1072
1073 The "2 behind" is telling you that there are 2 new changesets over the base of the topic. 1073 The "2 behind" is telling you that there are 2 new changesets on top of the base of the topic.
1074 1074
1075 Pushing that topic would create a new head, and therefore will be prevented: 1075 Pushing that topic would create a new head, and therefore will be prevented:
1076 1076
1077 $ hg push --rev drinks 1077 $ hg push --rev drinks
1078 pushing to $TESTTMP/server (glob) 1078 pushing to $TESTTMP/server (glob)
1079 searching for changes 1079 searching for changes
1080 abort: push creates new remote head 70dfa201ed73! 1080 abort: push creates new remote head 0b8a99ba9213!
1081 (merge or see 'hg help push' for details about pushing new heads) 1081 (merge or see 'hg help push' for details about pushing new heads)
1082 [255] 1082 [255]
1083 1083
1084 1084
1085 Even after a rebase, pushing all active topics at the same time would publish 1085 Even after a rebase, pushing all active topics at the same time would publish
1086 them to the default branch, and then mercurial would complain about the 1086 them to the default branch, and then Mercurial would complain about the
1087 multiple *public* heads it would create on that branch: 1087 multiple *public* heads it would create on that branch:
1088 1088
1089 $ hg rebase -b drinks 1089 $ hg rebase -b drinks
1090 rebasing 9:8dfa45bd5e0c "Adding apple juice" (drinks) 1090 rebasing 9:213e97c6cd8a "Adding apple juice" (drinks)
1091 merging shopping 1091 merging shopping
1092 switching to topic drinks 1092 switching to topic drinks
1093 rebasing 10:70dfa201ed73 "Adding orange juice" (drinks) 1093 rebasing 10:0b8a99ba9213 "Adding orange juice" (drinks)
1094 merging shopping 1094 merging shopping
1095 switching to topic tools 1095 switching to topic tools
1096 1096
1097 $ hg push 1097 $ hg push
1098 pushing to $TESTTMP/server (glob) 1098 pushing to $TESTTMP/server (glob)
1099 searching for changes 1099 searching for changes
1100 abort: push creates new remote head 4cd7c1591a67! 1100 abort: push creates new remote head 56656c6d1153!
1101 (merge or see 'hg help push' for details about pushing new heads) 1101 (merge or see 'hg help push' for details about pushing new heads)
1102 [255] 1102 [255]
1103 1103
1104 Publishing only one of them is allowed (as long as it does not create a new 1104 Publishing only one of them is allowed (as long as it does not create a new
1105 branch head as we just saw in the previous case): 1105 branch head as we just saw in the previous case):
1111 adding manifests 1111 adding manifests
1112 adding file changes 1112 adding file changes
1113 added 2 changesets with 2 changes to 1 files 1113 added 2 changesets with 2 changes to 1 files
1114 2 new obsolescence markers 1114 2 new obsolescence markers
1115 1115
1116 The published topic has now faded out, and the other is now marked as 1116 The published topic has now faded out, and the other is now marked as being
1117 "behind": 1117 "behind":
1118 1118
1119 $ hg topics --verbose 1119 $ hg topics --verbose
1120 * tools (on branch: default, 3 changesets, 2 behind) 1120 * tools (on branch: default, 3 changesets, 2 behind)
1121 1121
1131 =========================== 1131 ===========================
1132 1132
1133 Navigating within your stack 1133 Navigating within your stack
1134 ---------------------------- 1134 ----------------------------
1135 1135
1136 As we saw before `stack` displays changesets on your current topic in a clean way: 1136 As we saw before ``stack`` displays changesets on your current topic in a clean way:
1137 1137
1138 $ hg topics --verbose 1138 $ hg topics --verbose
1139 * tools (on branch: default, 3 changesets, 2 behind) 1139 * tools (on branch: default, 3 changesets, 2 behind)
1140 1140
1141 $ hg stack 1141 $ hg stack
1144 s3@ Adding drill (current) 1144 s3@ Adding drill (current)
1145 s2: Adding saw 1145 s2: Adding saw
1146 s1: Adding hammer 1146 s1: Adding hammer
1147 s0^ add a pair of shoes (base) 1147 s0^ add a pair of shoes (base)
1148 1148
1149 You can navigate in your current stack with `previous` and `next`. 1149 You can navigate in your current stack with ``previous`` and ``next``.
1150 1150
1151 `previous` will bring you back to the parent of the topic head. 1151 ``previous`` will bring you back to the parent of the topic head.
1152 1152
1153 $ hg previous 1153 $ hg previous
1154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1155 [s2] Adding saw 1155 [s2] Adding saw
1156 1156
1160 s3: Adding drill 1160 s3: Adding drill
1161 s2@ Adding saw (current) 1161 s2@ Adding saw (current)
1162 s1: Adding hammer 1162 s1: Adding hammer
1163 s0^ add a pair of shoes (base) 1163 s0^ add a pair of shoes (base)
1164 1164
1165 `next` will move you forward to the topic head. 1165 ``next`` will move you forward to the topic head.
1166 1166
1167 $ hg next 1167 $ hg next
1168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1169 [s3] Adding drill 1169 [s3] Adding drill
1170 1170
1174 s3@ Adding drill (current) 1174 s3@ Adding drill (current)
1175 s2: Adding saw 1175 s2: Adding saw
1176 s1: Adding hammer 1176 s1: Adding hammer
1177 s0^ add a pair of shoes (base) 1177 s0^ add a pair of shoes (base)
1178 1178
1179 You can also directly jump to a changeset within your stack with the revset `t#`. 1179 You can also directly jump to a changeset within your stack with the revset ``s<number>``.
1180 1180
1181 $ hg update s1 1181 $ hg update s1
1182 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1182 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1183 1183
1184 $ hg stack 1184 $ hg stack
1207 1207
1208 Understanding the current situation with hg log is not so easy, because 1208 Understanding the current situation with hg log is not so easy, because
1209 it shows too many things: 1209 it shows too many things:
1210 1210
1211 $ hg log -G -r "s0::" 1211 $ hg log -G -r "s0::"
1212 @ changeset: 18:b7509bd417f8 1212 @ changeset: 18:2c1a47a5c075
1213 | tag: tip 1213 | tag: tip
1214 | topic: tools 1214 | topic: tools
1215 | parent: 12:fbff9bc37a43 1215 | parent: 12:033bfcc0ecb0
1216 | user: test 1216 | user: test
1217 | date: Thu Jan 01 00:00:00 1970 +0000 1217 | date: Thu Jan 01 00:00:00 1970 +0000
1218 | summary: Adding hammer to the shopping list 1218 | summary: Adding hammer to the shopping list
1219 | 1219 |
1220 | o changeset: 17:4cd7c1591a67 1220 | o changeset: 17:9dc8cec494f3
1221 | | user: test 1221 | | user: test
1222 | | date: Thu Jan 01 00:00:00 1970 +0000 1222 | | date: Thu Jan 01 00:00:00 1970 +0000
1223 | | summary: Adding orange juice 1223 | | summary: Adding orange juice
1224 | | 1224 | |
1225 | o changeset: 16:20759cb47ff8 1225 | o changeset: 16:9dfd6068e8e7
1226 |/ parent: 12:fbff9bc37a43 1226 |/ parent: 12:033bfcc0ecb0
1227 | user: test 1227 | user: test
1228 | date: Thu Jan 01 00:00:00 1970 +0000 1228 | date: Thu Jan 01 00:00:00 1970 +0000
1229 | summary: Adding apple juice 1229 | summary: Adding apple juice
1230 | 1230 |
1231 | * changeset: 15:bb1e6254f532 1231 | * changeset: 15:56656c6d1153
1232 | | topic: tools 1232 | | topic: tools
1233 | | user: test 1233 | | user: test
1234 | | date: Thu Jan 01 00:00:00 1970 +0000 1234 | | date: Thu Jan 01 00:00:00 1970 +0000
1235 | | instability: orphan 1235 | | instability: orphan
1236 | | summary: Adding drill 1236 | | summary: Adding drill
1237 | | 1237 | |
1238 | * changeset: 14:d4f97f32f8a1 1238 | * changeset: 14:a0ec1a6dcdce
1239 | | topic: tools 1239 | | topic: tools
1240 | | user: test 1240 | | user: test
1241 | | date: Thu Jan 01 00:00:00 1970 +0000 1241 | | date: Thu Jan 01 00:00:00 1970 +0000
1242 | | instability: orphan 1242 | | instability: orphan
1243 | | summary: Adding saw 1243 | | summary: Adding saw
1244 | | 1244 | |
1245 | x changeset: 13:a8ab3599d53d 1245 | x changeset: 13:dcb888ba1623
1246 |/ topic: tools 1246 |/ topic: tools
1247 | user: test 1247 | user: test
1248 | date: Thu Jan 01 00:00:00 1970 +0000 1248 | date: Thu Jan 01 00:00:00 1970 +0000
1249 | obsolete: reworded using amend as 18:b7509bd417f8 1249 | obsolete: reworded using amend as 18:2c1a47a5c075
1250 | summary: Adding hammer 1250 | summary: Adding hammer
1251 | 1251 |
1252 o changeset: 12:fbff9bc37a43 1252 o changeset: 12:033bfcc0ecb0
1253 | user: test 1253 | user: test
1254 ~ date: Thu Jan 01 00:00:00 1970 +0000 1254 ~ date: Thu Jan 01 00:00:00 1970 +0000
1255 summary: add a pair of shoes 1255 summary: add a pair of shoes
1256 1256
1257 1257
1362 s3$ Adding drill (orphan) 1362 s3$ Adding drill (orphan)
1363 s2$ Adding saw (orphan) 1363 s2$ Adding saw (orphan)
1364 s1@ Adding hammer to the shopping list (current) 1364 s1@ Adding hammer to the shopping list (current)
1365 s0^ add a pair of shoes (base) 1365 s0^ add a pair of shoes (base)
1366 1366
1367 It's easy to stabilize the situation, `next` has an `--evolve` option. It will 1367 It's easy to stabilize the situation, ``next`` has an ``--evolve`` option
1368 do the necessary relocation of `s2` and `s3` over the new `s1` without having 1368 (turned on by default nowadays). It will do the necessary relocation of `s2`
1369 to do that rebase by hand.: 1369 and `s3` over the new `s1` without having to do that rebase by hand:
1370 1370
1371 $ hg next --evolve 1371 $ hg next --evolve
1372 move:[s2] Adding saw 1372 move:[s2] Adding saw
1373 atop:[s1] Adding hammer to the shopping list 1373 atop:[s1] Adding hammer to the shopping list
1374 working directory is now at d5c51ee5762a 1374 working directory is now at 7537e3a3cbca
1375 1375
1376 $ hg stack 1376 $ hg stack
1377 ### topic: tools 1377 ### topic: tools
1378 ### target: default (branch), 2 behind 1378 ### target: default (branch), 2 behind
1379 s3$ Adding drill (orphan) 1379 s3$ Adding drill (orphan)
1384 One more to go: 1384 One more to go:
1385 1385
1386 $ hg next --evolve 1386 $ hg next --evolve
1387 move:[s3] Adding drill 1387 move:[s3] Adding drill
1388 atop:[s2] Adding saw 1388 atop:[s2] Adding saw
1389 working directory is now at bae3758e46bf 1389 working directory is now at 9d65331e0dc1
1390 1390
1391 $ hg stack 1391 $ hg stack
1392 ### topic: tools 1392 ### topic: tools
1393 ### target: default (branch), 2 behind 1393 ### target: default (branch), 2 behind
1394 s3@ Adding drill (current) 1394 s3@ Adding drill (current)
1395 s2: Adding saw 1395 s2: Adding saw
1396 s1: Adding hammer to the shopping list 1396 s1: Adding hammer to the shopping list
1397 s0^ add a pair of shoes (base) 1397 s0^ add a pair of shoes (base)
1398 1398
1399 Let's take a look at `hg log` once again: 1399 Let's take a look at ``hg log`` once again:
1400 1400
1401 $ hg log -G -r "s0::" 1401 $ hg log -G -r "s0::"
1402 @ changeset: 20:bae3758e46bf 1402 @ changeset: 20:9d65331e0dc1
1403 | tag: tip 1403 | tag: tip
1404 | topic: tools 1404 | topic: tools
1405 | user: test 1405 | user: test
1406 | date: Thu Jan 01 00:00:00 1970 +0000 1406 | date: Thu Jan 01 00:00:00 1970 +0000
1407 | summary: Adding drill 1407 | summary: Adding drill
1408 | 1408 |
1409 o changeset: 19:d5c51ee5762a 1409 o changeset: 19:7537e3a3cbca
1410 | topic: tools 1410 | topic: tools
1411 | user: test 1411 | user: test
1412 | date: Thu Jan 01 00:00:00 1970 +0000 1412 | date: Thu Jan 01 00:00:00 1970 +0000
1413 | summary: Adding saw 1413 | summary: Adding saw
1414 | 1414 |
1415 o changeset: 18:b7509bd417f8 1415 o changeset: 18:2c1a47a5c075
1416 | topic: tools 1416 | topic: tools
1417 | parent: 12:fbff9bc37a43 1417 | parent: 12:033bfcc0ecb0
1418 | user: test 1418 | user: test
1419 | date: Thu Jan 01 00:00:00 1970 +0000 1419 | date: Thu Jan 01 00:00:00 1970 +0000
1420 | summary: Adding hammer to the shopping list 1420 | summary: Adding hammer to the shopping list
1421 | 1421 |
1422 | o changeset: 17:4cd7c1591a67 1422 | o changeset: 17:9dc8cec494f3
1423 | | user: test 1423 | | user: test
1424 | | date: Thu Jan 01 00:00:00 1970 +0000 1424 | | date: Thu Jan 01 00:00:00 1970 +0000
1425 | | summary: Adding orange juice 1425 | | summary: Adding orange juice
1426 | | 1426 | |
1427 | o changeset: 16:20759cb47ff8 1427 | o changeset: 16:9dfd6068e8e7
1428 |/ parent: 12:fbff9bc37a43 1428 |/ parent: 12:033bfcc0ecb0
1429 | user: test 1429 | user: test
1430 | date: Thu Jan 01 00:00:00 1970 +0000 1430 | date: Thu Jan 01 00:00:00 1970 +0000
1431 | summary: Adding apple juice 1431 | summary: Adding apple juice
1432 | 1432 |
1433 o changeset: 12:fbff9bc37a43 1433 o changeset: 12:033bfcc0ecb0
1434 | user: test 1434 | user: test
1435 ~ date: Thu Jan 01 00:00:00 1970 +0000 1435 ~ date: Thu Jan 01 00:00:00 1970 +0000
1436 summary: add a pair of shoes 1436 summary: add a pair of shoes
1437 1437
1438 1438
1546 Merge within a multi-headed stack will use the other topic head as 1546 Merge within a multi-headed stack will use the other topic head as
1547 destination if the topic has two heads. But rebasing will yield a 1547 destination if the topic has two heads. But rebasing will yield a
1548 completely linear history so it's what we will do. 1548 completely linear history so it's what we will do.
1549 1549
1550 $ hg log -G 1550 $ hg log -G
1551 @ changeset: 21:f936c6da9d61 1551 @ changeset: 21:69ad92f8ff49
1552 | tag: tip 1552 | tag: tip
1553 | topic: tools 1553 | topic: tools
1554 | parent: 18:b7509bd417f8 1554 | parent: 18:2c1a47a5c075
1555 | user: test 1555 | user: test
1556 | date: Thu Jan 01 00:00:00 1970 +0000 1556 | date: Thu Jan 01 00:00:00 1970 +0000
1557 | summary: Adding nails 1557 | summary: Adding nails
1558 | 1558 |
1559 | o changeset: 20:bae3758e46bf 1559 | o changeset: 20:9d65331e0dc1
1560 | | topic: tools 1560 | | topic: tools
1561 | | user: test 1561 | | user: test
1562 | | date: Thu Jan 01 00:00:00 1970 +0000 1562 | | date: Thu Jan 01 00:00:00 1970 +0000
1563 | | summary: Adding drill 1563 | | summary: Adding drill
1564 | | 1564 | |
1565 | o changeset: 19:d5c51ee5762a 1565 | o changeset: 19:7537e3a3cbca
1566 |/ topic: tools 1566 |/ topic: tools
1567 | user: test 1567 | user: test
1568 | date: Thu Jan 01 00:00:00 1970 +0000 1568 | date: Thu Jan 01 00:00:00 1970 +0000
1569 | summary: Adding saw 1569 | summary: Adding saw
1570 | 1570 |
1571 o changeset: 18:b7509bd417f8 1571 o changeset: 18:2c1a47a5c075
1572 | topic: tools 1572 | topic: tools
1573 | parent: 12:fbff9bc37a43 1573 | parent: 12:033bfcc0ecb0
1574 | user: test 1574 | user: test
1575 | date: Thu Jan 01 00:00:00 1970 +0000 1575 | date: Thu Jan 01 00:00:00 1970 +0000
1576 | summary: Adding hammer to the shopping list 1576 | summary: Adding hammer to the shopping list
1577 | 1577 |
1578 | o changeset: 17:4cd7c1591a67 1578 | o changeset: 17:9dc8cec494f3
1579 | | user: test 1579 | | user: test
1580 | | date: Thu Jan 01 00:00:00 1970 +0000 1580 | | date: Thu Jan 01 00:00:00 1970 +0000
1581 | | summary: Adding orange juice 1581 | | summary: Adding orange juice
1582 | | 1582 | |
1583 | o changeset: 16:20759cb47ff8 1583 | o changeset: 16:9dfd6068e8e7
1584 |/ parent: 12:fbff9bc37a43 1584 |/ parent: 12:033bfcc0ecb0
1585 | user: test 1585 | user: test
1586 | date: Thu Jan 01 00:00:00 1970 +0000 1586 | date: Thu Jan 01 00:00:00 1970 +0000
1587 | summary: Adding apple juice 1587 | summary: Adding apple juice
1588 | 1588 |
1589 o changeset: 12:fbff9bc37a43 1589 o changeset: 12:033bfcc0ecb0
1590 | user: test 1590 | user: test
1591 | date: Thu Jan 01 00:00:00 1970 +0000 1591 | date: Thu Jan 01 00:00:00 1970 +0000
1592 | summary: add a pair of shoes 1592 | summary: add a pair of shoes
1593 | 1593 |
1594 o changeset: 11:f2d6cacc6115 1594 o changeset: 11:bbfb218049cd
1595 | parent: 5:2d50db8b5b4c 1595 | parent: 5:fec062fcfcfa
1596 | user: test 1596 | user: test
1597 | date: Thu Jan 01 00:00:00 1970 +0000 1597 | date: Thu Jan 01 00:00:00 1970 +0000
1598 | summary: add a coat 1598 | summary: add a coat
1599 | 1599 |
1600 o changeset: 5:2d50db8b5b4c 1600 o changeset: 5:fec062fcfcfa
1601 | user: test 1601 | user: test
1602 | date: Thu Jan 01 00:00:00 1970 +0000 1602 | date: Thu Jan 01 00:00:00 1970 +0000
1603 | summary: adding fruits 1603 | summary: adding fruits
1604 | 1604 |
1605 o changeset: 4:4011b46eeb33 1605 o changeset: 4:d3a1ea2a0337
1606 | user: test 1606 | user: test
1607 | date: Thu Jan 01 00:00:00 1970 +0000 1607 | date: Thu Jan 01 00:00:00 1970 +0000
1608 | summary: adding condiments 1608 | summary: adding condiments
1609 | 1609 |
1610 o changeset: 3:6104862e8b84 1610 o changeset: 3:6104862e8b84
1775 1775
1776 $ hg up s4 1776 $ hg up s4
1777 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1777 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1778 1778
1779 $ hg rebase 1779 $ hg rebase
1780 rebasing 19:d5c51ee5762a "Adding saw" (tools) 1780 rebasing 19:7537e3a3cbca "Adding saw" (tools)
1781 merging shopping 1781 merging shopping
1782 rebasing 20:bae3758e46bf "Adding drill" (tools) 1782 rebasing 20:9d65331e0dc1 "Adding drill" (tools)
1783 merging shopping 1783 merging shopping
1784 1784
1785 $ hg stack 1785 $ hg stack
1786 ### topic: tools 1786 ### topic: tools
1787 ### target: default (branch), 2 behind 1787 ### target: default (branch), 2 behind
1830 adding file changes 1830 adding file changes
1831 added 4 changesets with 4 changes to 1 files (+1 heads) 1831 added 4 changesets with 4 changes to 1 files (+1 heads)
1832 8 new obsolescence markers 1832 8 new obsolescence markers
1833 1833
1834 Pushing the new topic branch to a non-publishing server did not require 1834 Pushing the new topic branch to a non-publishing server did not require
1835 --force. As long as new heads are on their own topic, Mercurial will not 1835 ``--force``. As long as new heads are on their own topic, Mercurial will not
1836 complain about them. 1836 complain about them.
1837 1837
1838 From another client, we will get them with their topic: 1838 From another client, we will get them with their topic:
1839 1839
1840 $ cd ../other-client 1840 $ cd ../other-client
1845 adding changesets 1845 adding changesets
1846 adding manifests 1846 adding manifests
1847 adding file changes 1847 adding file changes
1848 added 4 changesets with 4 changes to 1 files (+1 heads) 1848 added 4 changesets with 4 changes to 1 files (+1 heads)
1849 8 new obsolescence markers 1849 8 new obsolescence markers
1850 new changesets b7509bd417f8:2d084ac00115 (4 drafts) 1850 new changesets 2c1a47a5c075:bbb9e269a01a (4 drafts)
1851 (run 'hg heads' to see heads) 1851 (run 'hg heads' to see heads)
1852 1852
1853 $ hg topics --verbose 1853 $ hg topics --verbose
1854 tools (on branch: default, 4 changesets, 2 behind) 1854 tools (on branch: default, 4 changesets, 2 behind)
1855 1855
1889 searching for changes 1889 searching for changes
1890 adding changesets 1890 adding changesets
1891 adding manifests 1891 adding manifests
1892 adding file changes 1892 adding file changes
1893 added 1 changesets with 1 changes to 1 files 1893 added 1 changesets with 1 changes to 1 files
1894 new changesets 0d409663a1fd (1 drafts) 1894 new changesets 71d37f5c73ed (1 drafts)
1895 (run 'hg update' to get a working copy) 1895 (run 'hg update' to get a working copy)
1896 1896
1897 $ hg update 1897 $ hg update
1898 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1898 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1899 1899