# HG changeset patch # User Boris Feld # Date 1501169917 -7200 # Node ID 498409c72dd23df44d87a254e1e107c5659206a3 # Parent 93588d219f2f28dda82f08769d25f4bc1dbd8e98 doc: various improvements on topic tutorial diff -r 93588d219f2f -r 498409c72dd2 tests/test-topic-tutorial.t --- a/tests/test-topic-tutorial.t Thu Jul 27 17:22:44 2017 +0200 +++ b/tests/test-topic-tutorial.t Thu Jul 27 17:38:37 2017 +0200 @@ -66,6 +66,7 @@ $ hg topic * food + $ hg summary parent: 0:38da43f0a2ea tip Shopping list @@ -73,6 +74,7 @@ commit: (clean) update: (current) topic: food + $ hg log --graph @ changeset: 0:38da43f0a2ea tag: tip @@ -89,7 +91,9 @@ > Vinegar > Oil > EOF + $ hg commit -m "adding condiments" + $ hg log --graph --rev 'topic("food")' @ changeset: 1:13900241408b | tag: tip @@ -106,7 +110,9 @@ > Pear > Apple > EOF + $ hg commit -m "adding fruits" + $ hg log --graph --rev 'topic("food")' @ changeset: 2:287de11b401f | tag: tip @@ -134,8 +140,9 @@ The topic deactivates when we update away from it: - $ hg up default + $ hg update default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg topic food @@ -163,24 +170,27 @@ And updating back to the topic reactivates it: - $ hg up food + $ hg update food switching to topic food 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg topic * food Updating to any changeset that is part of a topic activates the topic regardless of how the revision was specified: - $ hg up default + $ hg update default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg up --rev 'desc("condiments")' + + $ hg update --rev 'desc("condiments")' switching to topic food 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg topic * food -.. server side activity: +.. Server side activity: $ cd ../server/ $ cat > shopping << EOF @@ -194,7 +204,9 @@ > Blancmange > Salmon mousse > EOF + $ hg commit -A -m "Adding clothes" + $ cd ../client The topic will also affect the rebase and the merge destinations. Let's pull @@ -208,6 +220,7 @@ adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads) + $ hg log -G o changeset: 3:6104862e8b84 | tag: tip @@ -237,8 +250,9 @@ The topic head will not be considered when merging from the new head of the branch: - $ hg up default + $ hg update default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg merge abort: branch 'default' has one head - please merge with an explicit rev (run 'hg heads' to see all heads) @@ -246,15 +260,17 @@ But the topic will see that branch head as a valid destination: - $ hg up food + $ hg update food switching to topic food 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg rebase rebasing 1:13900241408b "adding condiments" merging shopping switching to topic food rebasing 2:287de11b401f "adding fruits" merging shopping + $ hg log --graph @ changeset: 5:2d50db8b5b4c | tag: tip @@ -285,6 +301,7 @@ $ hg topic * food + $ hg push pushing to $TESTTMP/server (glob) searching for changes @@ -293,8 +310,10 @@ adding file changes added 2 changesets with 2 changes to 1 files 2 new obsolescence markers + $ hg topic * food + $ hg log --graph @ changeset: 5:2d50db8b5b4c | tag: tip @@ -318,7 +337,7 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: Shopping list - $ hg up default + $ hg update default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Working with Multiple Topics @@ -333,23 +352,27 @@ $ hg topic tools $ echo hammer >> shopping - $ hg ci -m 'Adding hammer' + $ hg commit -m 'Adding hammer' + $ echo saw >> shopping - $ hg ci -m 'Adding saw' + $ hg commit -m 'Adding saw' + $ echo drill >> shopping - $ hg ci -m 'Adding drill' + $ hg commit -m 'Adding drill' But we are not sure we will actually go to the hardware store, so in the meantime, we want to extend the list with drinks. We go back to the official default branch and start a new topic: - $ hg up default + $ hg update default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg topic drinks $ echo 'apple juice' >> shopping - $ hg ci -m 'Adding apple juice' + $ hg commit -m 'Adding apple juice' + $ echo 'orange juice' >> shopping - $ hg ci -m 'Adding orange juice' + $ hg commit -m 'Adding orange juice' We now have two topics: @@ -365,9 +388,11 @@ t2@ Adding orange juice (current) t1: Adding apple juice t0^ adding fruits (base) - $ hg up tools + + $ hg update tools switching to topic tools 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg stack ### topic: tools ### branch: default @@ -383,20 +408,20 @@ nothing to rebase [1] -.. server activity: +Server activity: $ cd ../server - $ hg up + $ hg update 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ mv shopping foo $ echo 'Coat' > shopping $ cat foo >> shopping - $ hg ci -m 'add a coat' + $ hg commit -m 'add a coat' $ echo 'Coat' > shopping $ echo 'Shoes' >> shopping $ cat foo >> shopping $ rm foo - $ hg ci -m 'add a pair of shoes' + $ hg commit -m 'add a pair of shoes' $ cd ../client Let's see what other people did in the meantime: @@ -413,6 +438,71 @@ There are new changes! We can simply use ``hg rebase`` to update our changeset on top of the latest: + $ hg log -G + o changeset: 12:fbff9bc37a43 + | tag: tip + | 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: 10:70dfa201ed73 + | | topic: drinks + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: Adding orange juice + | | + | o changeset: 9:8dfa45bd5e0c + |/ topic: drinks + | parent: 5:2d50db8b5b4c + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: Adding apple juice + | + | @ changeset: 8:34255b455dac + | | topic: tools + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: Adding drill + | | + | o changeset: 7:cffff85af537 + | | topic: tools + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: Adding saw + | | + | o changeset: 6:183984ef46d1 + |/ topic: tools + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: Adding hammer + | + 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 rebase rebasing 6:183984ef46d1 "Adding hammer" merging shopping @@ -452,6 +542,7 @@ rebasing 10:70dfa201ed73 "Adding orange juice" merging shopping switching to topic tools + $ hg push pushing to $TESTTMP/server (glob) searching for changes @@ -476,6 +567,7 @@ $ hg topic --verbose * tools (on branch: default, 3 changesets, 2 behind) + $ hg stack ### topic: tools ### branch: default, 2 behind