tests/test-topic-tutorial.t
branchstable
changeset 2830 499b2dd69107
parent 2829 1c529afd3fef
child 2833 08a64770ed24
--- a/tests/test-topic-tutorial.t	Fri Sep 30 18:22:30 2016 +0200
+++ b/tests/test-topic-tutorial.t	Fri Sep 30 18:23:04 2016 +0200
@@ -796,7 +796,9 @@
   $ hg up t1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-  $ echo nails >> shopping
+  $ echo "nails" > new_shopping
+  $ cat shopping >> new_shopping
+  $ mv new_shopping shopping
 
   $ hg commit -m 'Adding nails'
 
@@ -809,3 +811,215 @@
   t2@ Adding nails (current)
   t1: Adding hammer to the shopping list
   t0^ add a pair of shoes (base)
+
+Solving this situation is easy with a topic, use merge or rebase.
+Merge within a multi-headed stack will use the other topic head as
+redestination if the topic has multiple heads.
+
+  $ hg log -G
+  @  changeset:   21:f936c6da9d61
+  |  tag:         tip
+  |  topic:       tools
+  |  parent:      18:b7509bd417f8
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     Adding nails
+  |
+  | o  changeset:   20:bae3758e46bf
+  | |  topic:       tools
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     Adding drill
+  | |
+  | o  changeset:   19:d5c51ee5762a
+  |/   topic:       tools
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     Adding saw
+  |
+  o  changeset:   18:b7509bd417f8
+  |  topic:       tools
+  |  parent:      12:fbff9bc37a43
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     Adding hammer to the shopping list
+  |
+  | o  changeset:   17:4cd7c1591a67
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     Adding orange juice
+  | |
+  | o  changeset:   16:20759cb47ff8
+  |/   parent:      12:fbff9bc37a43
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     Adding apple juice
+  |
+  o  changeset:   12:fbff9bc37a43
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add a pair of shoes
+  |
+  o  changeset:   11:f2d6cacc6115
+  |  parent:      5:2d50db8b5b4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add a coat
+  |
+  o  changeset:   5:2d50db8b5b4c
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     adding fruits
+  |
+  o  changeset:   4:4011b46eeb33
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     adding condiments
+  |
+  o  changeset:   3:6104862e8b84
+  |  parent:      0:38da43f0a2ea
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     Adding clothes
+  |
+  o  changeset:   0:38da43f0a2ea
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     Shopping list
+  
+
+  $ hg up t4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg rebase
+  rebasing 19:d5c51ee5762a "Adding saw"
+  merging shopping
+  rebasing 20:bae3758e46bf "Adding drill"
+  merging shopping
+
+  $ hg commit -m "Merge tools"
+  nothing changed
+  [1]
+
+  $ hg stack
+  ### topic: tools
+  ### branch: default, 2 behind
+  t4@ Adding drill (current)
+  t3: Adding saw
+  t2: Adding nails
+  t1: Adding hammer to the shopping list
+  t0^ add a pair of shoes (base)
+
+Collaborating through non-publishing server
+===========================================
+
+.. setup:
+
+.. Let's create a non-publishing server:
+
+  $ cd ..
+
+  $ hg clone server non-publishing-server
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd non-publishing-server
+  $ cat >> .hg/hgrc << EOF
+  > [phases]
+  > publish = false
+  > EOF
+
+.. And another client:
+
+  $ cd ..
+
+  $ hg clone server other-client
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd client
+
+We can now share theses drafts changesets:
+
+  $ hg push ../non-publishing-server -r tools
+  pushing to ../non-publishing-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 4 changes to 1 files (+1 heads)
+  8 new obsolescence markers
+
+Pushing the new topic branch to a non publishing server did not required
+--force. As long as new heads are on their own topic, Mercurial will not
+complains about them.
+
+From another client, we will gets them with their topic:
+
+  $ cd ../other-client
+
+  $ hg pull ../non-publishing-server
+  pulling from ../non-publishing-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 4 changes to 1 files (+1 heads)
+  8 new obsolescence markers
+  (run 'hg heads' to see heads)
+
+  $ hg topics --verbose
+     tools (on branch: default, 4 changesets, 2 behind)
+
+  $ hg up tools
+  switching to topic tools
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg stack
+  ### topic: tools
+  ### branch: default, 2 behind
+  t4@ Adding drill (current)
+  t3: Adding saw
+  t2: Adding nails
+  t1: Adding hammer to the shopping list
+  t0^ add a pair of shoes (base)
+
+We can also add new changesets and share them:
+
+  $ echo screws >> shopping
+
+  $ hg commit -A -m "Adding screws"
+
+  $ hg push ../non-publishing-server
+  pushing to ../non-publishing-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+And retrieve them on the first client:
+
+  $ cd ../client
+
+  $ hg pull ../non-publishing-server
+  pulling from ../non-publishing-server
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg stack
+  ### topic: tools
+  ### branch: default, 2 behind
+  t5@ Adding screws (current)
+  t4: Adding drill
+  t3: Adding saw
+  t2: Adding nails
+  t1: Adding hammer to the shopping list
+  t0^ add a pair of shoes (base)