tests/test-topic-tutorial.t
branchmercurial-4.5
changeset 4075 dc247e648f43
parent 3924 f3713d41b85b
parent 4067 fb4801478d5d
child 4076 f9a850018daa
child 4172 35c21ab64420
equal deleted inserted replaced
4031:9a2db13b2e99 4075:dc247e648f43
   250 command:
   250 command:
   251 
   251 
   252   $ hg stack
   252   $ hg stack
   253   ### topic: food
   253   ### topic: food
   254   ### target: default (branch)
   254   ### target: default (branch)
   255   t2@ adding fruits (current)
   255   s2@ adding fruits (current)
   256   t1: adding condiments
   256   s1: adding condiments
   257   t0^ Shopping list (base)
   257   s0^ Shopping list (base)
   258 
   258 
   259 The topic deactivates when we update away from it:
   259 The topic deactivates when we update away from it:
   260 
   260 
   261   $ hg update default
   261   $ hg update default
   262   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   262   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   611 
   611 
   612   $ hg topics --list
   612   $ hg topics --list
   613   ### topic: food
   613   ### topic: food
   614   ### target: default (branch)
   614   ### target: default (branch)
   615   (stack is empty)
   615   (stack is empty)
   616   t0^ adding fruits (base current)
   616   s0^ adding fruits (base current)
   617 
   617 
   618   $ hg log --graph
   618   $ hg log --graph
   619   @  changeset:   5:2d50db8b5b4c
   619   @  changeset:   5:2d50db8b5b4c
   620   |  tag:         tip
   620   |  tag:         tip
   621   |  user:        test
   621   |  user:        test
   788 The information displayed by ``hg stack`` adapts to the active topic:
   788 The information displayed by ``hg stack`` adapts to the active topic:
   789 
   789 
   790   $ hg stack
   790   $ hg stack
   791   ### topic: drinks
   791   ### topic: drinks
   792   ### target: default (branch)
   792   ### target: default (branch)
   793   t2@ Adding orange juice (current)
   793   s2@ Adding orange juice (current)
   794   t1: Adding apple juice
   794   s1: Adding apple juice
   795   t0^ adding fruits (base)
   795   s0^ adding fruits (base)
   796 
   796 
   797   $ hg update tools
   797   $ hg update tools
   798   switching to topic tools
   798   switching to topic tools
   799   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   799   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   800 
   800 
   801   $ hg stack
   801   $ hg stack
   802   ### topic: tools
   802   ### topic: tools
   803   ### target: default (branch)
   803   ### target: default (branch)
   804   t3@ Adding drill (current)
   804   s3@ Adding drill (current)
   805   t2: Adding saw
   805   s2: Adding saw
   806   t1: Adding hammer
   806   s1: Adding hammer
   807   t0^ adding fruits (base)
   807   s0^ adding fruits (base)
   808 
   808 
   809 They are seen as independent branches by Mercurial. No rebase or merge
   809 They are seen as independent branches by Mercurial. No rebase or merge
   810 between them will be attempted by default:
   810 between them will be attempted by default:
   811 
   811 
   812   $ hg rebase
   812   $ hg rebase
  1118    * tools (on branch: default, 3 changesets, 2 behind)
  1118    * tools (on branch: default, 3 changesets, 2 behind)
  1119 
  1119 
  1120   $ hg stack
  1120   $ hg stack
  1121   ### topic: tools
  1121   ### topic: tools
  1122   ### target: default (branch), 2 behind
  1122   ### target: default (branch), 2 behind
  1123   t3@ Adding drill (current)
  1123   s3@ Adding drill (current)
  1124   t2: Adding saw
  1124   s2: Adding saw
  1125   t1: Adding hammer
  1125   s1: Adding hammer
  1126   t0^ add a pair of shoes (base)
  1126   s0^ add a pair of shoes (base)
  1127 
  1127 
  1128 Working Within Your Stack
  1128 Working Within Your Stack
  1129 ===========================
  1129 ===========================
  1130 
  1130 
  1131 Navigating within your stack
  1131 Navigating within your stack
  1137    * tools (on branch: default, 3 changesets, 2 behind)
  1137    * tools (on branch: default, 3 changesets, 2 behind)
  1138 
  1138 
  1139   $ hg stack
  1139   $ hg stack
  1140   ### topic: tools
  1140   ### topic: tools
  1141   ### target: default (branch), 2 behind
  1141   ### target: default (branch), 2 behind
  1142   t3@ Adding drill (current)
  1142   s3@ Adding drill (current)
  1143   t2: Adding saw
  1143   s2: Adding saw
  1144   t1: Adding hammer
  1144   s1: Adding hammer
  1145   t0^ add a pair of shoes (base)
  1145   s0^ add a pair of shoes (base)
  1146 
  1146 
  1147 You can navigate in your current stack with `previous` and `next`.
  1147 You can navigate in your current stack with `previous` and `next`.
  1148 
  1148 
  1149 `previous` will bring you back to the parent of the topic head.
  1149 `previous` will bring you back to the parent of the topic head.
  1150 
  1150 
  1153   [14] Adding saw
  1153   [14] Adding saw
  1154 
  1154 
  1155   $ hg stack
  1155   $ hg stack
  1156   ### topic: tools
  1156   ### topic: tools
  1157   ### target: default (branch), 2 behind
  1157   ### target: default (branch), 2 behind
  1158   t3: Adding drill
  1158   s3: Adding drill
  1159   t2@ Adding saw (current)
  1159   s2@ Adding saw (current)
  1160   t1: Adding hammer
  1160   s1: Adding hammer
  1161   t0^ add a pair of shoes (base)
  1161   s0^ add a pair of shoes (base)
  1162 
  1162 
  1163 `next` will move you forward to the topic head.
  1163 `next` will move you forward to the topic head.
  1164 
  1164 
  1165   $ hg next
  1165   $ hg next
  1166   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1166   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1167   [15] Adding drill
  1167   [15] Adding drill
  1168 
  1168 
  1169   $ hg stack
  1169   $ hg stack
  1170   ### topic: tools
  1170   ### topic: tools
  1171   ### target: default (branch), 2 behind
  1171   ### target: default (branch), 2 behind
  1172   t3@ Adding drill (current)
  1172   s3@ Adding drill (current)
  1173   t2: Adding saw
  1173   s2: Adding saw
  1174   t1: Adding hammer
  1174   s1: Adding hammer
  1175   t0^ add a pair of shoes (base)
  1175   s0^ add a pair of shoes (base)
  1176 
  1176 
  1177 You can also directly jump to a changeset within your stack with the revset `t#`.
  1177 You can also directly jump to a changeset within your stack with the revset `t#`.
  1178 
  1178 
  1179   $ hg update t1
  1179   $ hg update s1
  1180   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1180   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1181 
  1181 
  1182   $ hg stack
  1182   $ hg stack
  1183   ### topic: tools
  1183   ### topic: tools
  1184   ### target: default (branch), 2 behind
  1184   ### target: default (branch), 2 behind
  1185   t3: Adding drill
  1185   s3: Adding drill
  1186   t2: Adding saw
  1186   s2: Adding saw
  1187   t1@ Adding hammer (current)
  1187   s1@ Adding hammer (current)
  1188   t0^ add a pair of shoes (base)
  1188   s0^ add a pair of shoes (base)
  1189 
  1189 
  1190 Editing your work mid-stack
  1190 Editing your work mid-stack
  1191 ---------------------------
  1191 ---------------------------
  1192 
  1192 
  1193 It's easy to edit your work inside your stack:
  1193 It's easy to edit your work inside your stack:
  1194 
  1194 
  1195   $ hg stack
  1195   $ hg stack
  1196   ### topic: tools
  1196   ### topic: tools
  1197   ### target: default (branch), 2 behind
  1197   ### target: default (branch), 2 behind
  1198   t3: Adding drill
  1198   s3: Adding drill
  1199   t2: Adding saw
  1199   s2: Adding saw
  1200   t1@ Adding hammer (current)
  1200   s1@ Adding hammer (current)
  1201   t0^ add a pair of shoes (base)
  1201   s0^ add a pair of shoes (base)
  1202 
  1202 
  1203   $ hg amend -m "Adding hammer to the shopping list"
  1203   $ hg amend -m "Adding hammer to the shopping list"
  1204   2 new orphan changesets
  1204   2 new orphan changesets
  1205 
  1205 
  1206 Understanding the current situation with hg log is not so easy, because
  1206 Understanding the current situation with hg log is not so easy, because
  1207 it shows too many things:
  1207 it shows too many things:
  1208 
  1208 
  1209   $ hg log -G -r "t0::"
  1209   $ hg log -G -r "s0::"
  1210   @  changeset:   18:b7509bd417f8
  1210   @  changeset:   18:b7509bd417f8
  1211   |  tag:         tip
  1211   |  tag:         tip
  1212   |  topic:       tools
  1212   |  topic:       tools
  1213   |  parent:      12:fbff9bc37a43
  1213   |  parent:      12:fbff9bc37a43
  1214   |  user:        test
  1214   |  user:        test
  1252   ~  date:        Thu Jan 01 00:00:00 1970 +0000
  1252   ~  date:        Thu Jan 01 00:00:00 1970 +0000
  1253      summary:     add a pair of shoes
  1253      summary:     add a pair of shoes
  1254   
  1254   
  1255 
  1255 
  1256 #if docgraph-ext
  1256 #if docgraph-ext
  1257   $ hg docgraph -r "t0::" --sphinx-directive --rankdir LR #rest-ignore
  1257   $ hg docgraph -r "s0::" --sphinx-directive --rankdir LR #rest-ignore
  1258   .. graphviz::
  1258   .. graphviz::
  1259   
  1259   
  1260       strict digraph "Mercurial graph" {
  1260       strict digraph "Mercurial graph" {
  1261       	graph [rankdir=LR,
  1261       	graph [rankdir=LR,
  1262       		splines=polyline
  1262       		splines=polyline
  1355 Fortunately stack shows you a better visualization:
  1355 Fortunately stack shows you a better visualization:
  1356 
  1356 
  1357   $ hg stack
  1357   $ hg stack
  1358   ### topic: tools
  1358   ### topic: tools
  1359   ### target: default (branch), 2 behind
  1359   ### target: default (branch), 2 behind
  1360   t3$ Adding drill (unstable)
  1360   s3$ Adding drill (unstable)
  1361   t2$ Adding saw (unstable)
  1361   s2$ Adding saw (unstable)
  1362   t1@ Adding hammer to the shopping list (current)
  1362   s1@ Adding hammer to the shopping list (current)
  1363   t0^ add a pair of shoes (base)
  1363   s0^ add a pair of shoes (base)
  1364 
  1364 
  1365 It's easy to stabilize the situation, `next` has an `--evolve` option.  It will
  1365 It's easy to stabilize the situation, `next` has an `--evolve` option.  It will
  1366 do the necessary relocation of `t2` and `t3` over the new `t1` without having
  1366 do the necessary relocation of `s2` and `s3` over the new `s1` without having
  1367 to do that rebase by hand.:
  1367 to do that rebase by hand.:
  1368 
  1368 
  1369   $ hg next --evolve
  1369   $ hg next --evolve
  1370   move:[14] Adding saw
  1370   move:[14] Adding saw
  1371   atop:[18] Adding hammer to the shopping list
  1371   atop:[18] Adding hammer to the shopping list
  1372   working directory now at d5c51ee5762a
  1372   working directory now at d5c51ee5762a
  1373 
  1373 
  1374   $ hg stack
  1374   $ hg stack
  1375   ### topic: tools
  1375   ### topic: tools
  1376   ### target: default (branch), 2 behind
  1376   ### target: default (branch), 2 behind
  1377   t3$ Adding drill (unstable)
  1377   s3$ Adding drill (unstable)
  1378   t2@ Adding saw (current)
  1378   s2@ Adding saw (current)
  1379   t1: Adding hammer to the shopping list
  1379   s1: Adding hammer to the shopping list
  1380   t0^ add a pair of shoes (base)
  1380   s0^ add a pair of shoes (base)
  1381 
  1381 
  1382 One more to go:
  1382 One more to go:
  1383 
  1383 
  1384   $ hg next --evolve
  1384   $ hg next --evolve
  1385   move:[15] Adding drill
  1385   move:[15] Adding drill
  1387   working directory now at bae3758e46bf
  1387   working directory now at bae3758e46bf
  1388 
  1388 
  1389   $ hg stack
  1389   $ hg stack
  1390   ### topic: tools
  1390   ### topic: tools
  1391   ### target: default (branch), 2 behind
  1391   ### target: default (branch), 2 behind
  1392   t3@ Adding drill (current)
  1392   s3@ Adding drill (current)
  1393   t2: Adding saw
  1393   s2: Adding saw
  1394   t1: Adding hammer to the shopping list
  1394   s1: Adding hammer to the shopping list
  1395   t0^ add a pair of shoes (base)
  1395   s0^ add a pair of shoes (base)
  1396 
  1396 
  1397 Let's take a look at `hg log` once again:
  1397 Let's take a look at `hg log` once again:
  1398 
  1398 
  1399   $ hg log -G -r "t0::"
  1399   $ hg log -G -r "s0::"
  1400   @  changeset:   20:bae3758e46bf
  1400   @  changeset:   20:bae3758e46bf
  1401   |  tag:         tip
  1401   |  tag:         tip
  1402   |  topic:       tools
  1402   |  topic:       tools
  1403   |  user:        test
  1403   |  user:        test
  1404   |  date:        Thu Jan 01 00:00:00 1970 +0000
  1404   |  date:        Thu Jan 01 00:00:00 1970 +0000
  1433   ~  date:        Thu Jan 01 00:00:00 1970 +0000
  1433   ~  date:        Thu Jan 01 00:00:00 1970 +0000
  1434      summary:     add a pair of shoes
  1434      summary:     add a pair of shoes
  1435   
  1435   
  1436 
  1436 
  1437 #if docgraph-ext
  1437 #if docgraph-ext
  1438   $ hg docgraph -r "t0::" --sphinx-directive --rankdir LR #rest-ignore
  1438   $ hg docgraph -r "s0::" --sphinx-directive --rankdir LR #rest-ignore
  1439   .. graphviz::
  1439   .. graphviz::
  1440   
  1440   
  1441       strict digraph "Mercurial graph" {
  1441       strict digraph "Mercurial graph" {
  1442       	graph [rankdir=LR,
  1442       	graph [rankdir=LR,
  1443       		splines=polyline
  1443       		splines=polyline
  1518 Multi-headed stack
  1518 Multi-headed stack
  1519 ------------------
  1519 ------------------
  1520 
  1520 
  1521 Stack is also very helpful when you have a multi-headed stack:
  1521 Stack is also very helpful when you have a multi-headed stack:
  1522 
  1522 
  1523   $ hg up t1
  1523   $ hg up s1
  1524   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1524   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1525 
  1525 
  1526   $ echo "nails" > new_shopping
  1526   $ echo "nails" > new_shopping
  1527   $ cat shopping >> new_shopping
  1527   $ cat shopping >> new_shopping
  1528   $ mv new_shopping shopping
  1528   $ mv new_shopping shopping
  1530   $ hg commit -m 'Adding nails'
  1530   $ hg commit -m 'Adding nails'
  1531 
  1531 
  1532   $ hg stack
  1532   $ hg stack
  1533   ### topic: tools (2 heads)
  1533   ### topic: tools (2 heads)
  1534   ### target: default (branch), 2 behind
  1534   ### target: default (branch), 2 behind
  1535   t4: Adding drill
  1535   s4: Adding drill
  1536   t3: Adding saw
  1536   s3: Adding saw
  1537   t1^ Adding hammer to the shopping list (base)
  1537   s1^ Adding hammer to the shopping list (base)
  1538   t2@ Adding nails (current)
  1538   s2@ Adding nails (current)
  1539   t1: Adding hammer to the shopping list
  1539   s1: Adding hammer to the shopping list
  1540   t0^ add a pair of shoes (base)
  1540   s0^ add a pair of shoes (base)
  1541 
  1541 
  1542 Solving this situation is easy with a topic: use merge or rebase.
  1542 Solving this situation is easy with a topic: use merge or rebase.
  1543 Merge within a multi-headed stack will use the other topic head as
  1543 Merge within a multi-headed stack will use the other topic head as
  1544 destination if the topic has two heads. But rebasing will yield a
  1544 destination if the topic has two heads. But rebasing will yield a
  1545 completely linear history so it's what we will do.
  1545 completely linear history so it's what we will do.
  1768       	19 -> 20	 [arrowhead=none,
  1768       	19 -> 20	 [arrowhead=none,
  1769       		penwidth=2.0];
  1769       		penwidth=2.0];
  1770       }
  1770       }
  1771 #endif
  1771 #endif
  1772 
  1772 
  1773   $ hg up t4
  1773   $ hg up s4
  1774   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1774   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1775 
  1775 
  1776   $ hg rebase
  1776   $ hg rebase
  1777   rebasing 19:d5c51ee5762a "Adding saw" (tools)
  1777   rebasing 19:d5c51ee5762a "Adding saw" (tools)
  1778   merging shopping
  1778   merging shopping
  1780   merging shopping
  1780   merging shopping
  1781 
  1781 
  1782   $ hg stack
  1782   $ hg stack
  1783   ### topic: tools
  1783   ### topic: tools
  1784   ### target: default (branch), 2 behind
  1784   ### target: default (branch), 2 behind
  1785   t4@ Adding drill (current)
  1785   s4@ Adding drill (current)
  1786   t3: Adding saw
  1786   s3: Adding saw
  1787   t2: Adding nails
  1787   s2: Adding nails
  1788   t1: Adding hammer to the shopping list
  1788   s1: Adding hammer to the shopping list
  1789   t0^ add a pair of shoes (base)
  1789   s0^ add a pair of shoes (base)
  1790 
  1790 
  1791 Collaborating through a non-publishing server
  1791 Collaborating through a non-publishing server
  1792 =============================================
  1792 =============================================
  1793 
  1793 
  1794 .. setup:
  1794 .. setup:
  1855   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1855   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1856 
  1856 
  1857   $ hg stack
  1857   $ hg stack
  1858   ### topic: tools
  1858   ### topic: tools
  1859   ### target: default (branch), 2 behind
  1859   ### target: default (branch), 2 behind
  1860   t4@ Adding drill (current)
  1860   s4@ Adding drill (current)
  1861   t3: Adding saw
  1861   s3: Adding saw
  1862   t2: Adding nails
  1862   s2: Adding nails
  1863   t1: Adding hammer to the shopping list
  1863   s1: Adding hammer to the shopping list
  1864   t0^ add a pair of shoes (base)
  1864   s0^ add a pair of shoes (base)
  1865 
  1865 
  1866 We can also add new changesets and share them:
  1866 We can also add new changesets and share them:
  1867 
  1867 
  1868   $ echo screws >> shopping
  1868   $ echo screws >> shopping
  1869 
  1869 
  1895   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1895   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  1896 
  1896 
  1897   $ hg stack
  1897   $ hg stack
  1898   ### topic: tools
  1898   ### topic: tools
  1899   ### target: default (branch), 2 behind
  1899   ### target: default (branch), 2 behind
  1900   t5@ Adding screws (current)
  1900   s5@ Adding screws (current)
  1901   t4: Adding drill
  1901   s4: Adding drill
  1902   t3: Adding saw
  1902   s3: Adding saw
  1903   t2: Adding nails
  1903   s2: Adding nails
  1904   t1: Adding hammer to the shopping list
  1904   s1: Adding hammer to the shopping list
  1905   t0^ add a pair of shoes (base)
  1905   s0^ add a pair of shoes (base)