docs/tutorials/tutorial.t
changeset 209 7bee48a54c4a
parent 163 92b073d13f2d
child 211 69a37d56c7fb
equal deleted inserted replaced
208:05d6e3e36980 209:7bee48a54c4a
    17 
    17 
    18 First there is some setup phase you will understand later.
    18 First there is some setup phase you will understand later.
    19 
    19 
    20 there is a local repository and a remote one.
    20 there is a local repository and a remote one.
    21 
    21 
    22 Please close your eyes.
    22 
       
    23   $ cat >> $HGRCPATH << EOF
       
    24   > [ui]
       
    25   > logtemplate ="{node|short} ({phase}): {desc}\n"
       
    26   > [diff]
       
    27   > git = 1
       
    28   > [alias]
       
    29   > amend = amend -d '0 0'
       
    30   > [extensions]
       
    31   > hgext.graphlog=
       
    32   > hgext.rebase=
       
    33   > EOF
       
    34   $ $(dirname $TESTDIR)/enable.sh >> $HGRCPATH 2> /dev/null
    23 
    35 
    24   $ hg init local
    36   $ hg init local
    25   $ cat >> local/.hg/hgrc << EOF
    37   $ cat >> local/.hg/hgrc << EOF
    26   > [paths]
    38   > [paths]
    27   > remote = ../remote
    39   > remote = ../remote
    28   > [ui]
    40   > [ui]
    29   > user = Albert Beugras
    41   > user = Babar the King
    30   > [diff]
    42   > EOF
    31   > git = 1
    43 
    32   > [alias]
       
    33   > amend = amend -d '0 0'
       
    34   > tlog = log --template "{node|short}: '{desc}'\n"
       
    35   > ttlog = log --template "{node|short}: '{desc}' ({state})\n"
       
    36   > tglog = log -G --template "{node|short}: '{desc}' {branches}\n"
       
    37   > [extensions]
       
    38   > hgext.graphlog=
       
    39   > hgext.rebase=
       
    40   > EOF
       
    41   $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> local/.hg/hgrc
       
    42   $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> local/.hg/hgrc
       
    43   $ echo "evolution=$(echo $(dirname $TESTDIR))/hgext/evolution.py" >> local/.hg/hgrc
       
    44   $ hg init remote
    44   $ hg init remote
    45   $ cat >> remote/.hg/hgrc << EOF
    45   $ cat >> remote/.hg/hgrc << EOF
    46   > [paths]
    46   > [paths]
    47   > local = ../local
    47   > local = ../local
    48   > [ui]
    48   > [ui]
    49   > user = René de Robert
    49   > user = Celestine the Queen
    50   > [diff]
    50   > EOF
    51   > git = 1
    51 
    52   > [alias]
       
    53   > amend = amend -d '0 0'
       
    54   > tlog = log --template "{node|short}: '{desc}' {branches}\n"
       
    55   > ttlog = log --template "{node|short}: '{desc}' {state}\n"
       
    56   > tglog = log -G --template "{node|short}: '{desc}' {branches}\n"
       
    57   > [extensions]
       
    58   > hgext.graphlog=
       
    59   > hgext.rebase=
       
    60   > EOF
       
    61   $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> remote/.hg/hgrc
       
    62   $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> remote/.hg/hgrc
       
    63   $ echo "evolution=$(echo $(dirname $TESTDIR))/hgext/evolution.py" >> remote/.hg/hgrc
       
    64   $ cd local
    52   $ cd local
    65 
    53 
    66 You can reopen you eyes.
    54 You can reopen you eyes.
    67 
    55 
    68 Now we make a first version of our shopping list.
    56 Now we make a first version of our shopping list.
   105   > EOF
    93   > EOF
   106   $ hg commit -m "adding fruit"
    94   $ hg commit -m "adding fruit"
   107 
    95 
   108 I now have the following history:
    96 I now have the following history:
   109 
    97 
   110   $ hg tlog
    98   $ hg log
   111   d85de4546133: 'adding fruit'
    99   d85de4546133 (draft): adding fruit
   112   4d5dc8187023: 'adding condiment'
   100   4d5dc8187023 (draft): adding condiment
   113   7e82d3f3c2cb: 'Monthy Python Shopping list'
   101   7e82d3f3c2cb (public): Monthy Python Shopping list
   114 
   102 
   115 But, I just notice, I made a typo in Banana.
   103 But, I just notice, I made a typo in Banana.
   116 
   104 
   117   $ hg export tip
   105   $ hg export tip
   118   # HG changeset patch
   106   # HG changeset patch
   130    Vinegar
   118    Vinegar
   131    Oil
   119    Oil
   132   +Bananos
   120   +Bananos
   133   +Pear
   121   +Pear
   134   +Apple
   122   +Apple
       
   123 
       
   124 The faulty changeset is in the "draft" phase because he was not exchanged with the outside. The first one have been exchanged and is an immutable public changeset
       
   125 
       
   126   $ hg log
       
   127   d85de4546133 (draft): adding fruit
       
   128   4d5dc8187023 (draft): adding condiment
       
   129   7e82d3f3c2cb (public): Monthy Python Shopping list
   135 
   130 
   136 hopefully. I can use hg amend to rewrite my faulty changeset!
   131 hopefully. I can use hg amend to rewrite my faulty changeset!
   137 
   132 
   138   $ sed -i'' -e s/Bananos/Banana/ shopping
   133   $ sed -i'' -e s/Bananos/Banana/ shopping
   139   $ hg diff
   134   $ hg diff
   147   -Bananos
   142   -Bananos
   148   +Banana
   143   +Banana
   149    Pear
   144    Pear
   150    Apple
   145    Apple
   151   $ hg amend
   146   $ hg amend
   152   abort: can not rewrite immutable changeset d85de4546133
       
   153   [255]
       
   154 
       
   155 By default all changeset are considered "published" and can't be rewrittent.
       
   156 
       
   157  $ hg ttlog
       
   158 
       
   159 You need to enable a mutable state in your repo the "ready" one
       
   160 
       
   161   $ hg states ready --clever
       
   162   $ hg ttlog
       
   163   d85de4546133: 'adding fruit' (ready)
       
   164   4d5dc8187023: 'adding condiment' (ready)
       
   165   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
       
   166 
       
   167 Notice that changeset you already shared with the outside have been keep
       
   168 published.
       
   169 
       
   170 The changeset we want to rewrite is now in a mutable state.
       
   171 
       
   172   $ hg amend
       
   173 
   147 
   174 A new changeset with the right diff replace the wrong one.
   148 A new changeset with the right diff replace the wrong one.
   175 
   149 
   176   $ hg tlog
   150   $ hg log
   177   0cacb48f4482: 'adding fruit'
   151   0cacb48f4482 (draft): adding fruit
   178   4d5dc8187023: 'adding condiment'
   152   4d5dc8187023 (draft): adding condiment
   179   7e82d3f3c2cb: 'Monthy Python Shopping list'
   153   7e82d3f3c2cb (public): Monthy Python Shopping list
   180   $ hg export tip
   154   $ hg export tip
   181   # HG changeset patch
   155   # HG changeset patch
   182   # User test
   156   # User test
   183   # Date 0 0
   157   # Date 0 0
   184   # Node ID 0cacb48f44828d2fd31c4e45e18fde32a5b2f07b
   158   # Node ID 0cacb48f44828d2fd31c4e45e18fde32a5b2f07b
   220   added 1 changesets with 1 changes to 1 files (+1 heads)
   194   added 1 changesets with 1 changes to 1 files (+1 heads)
   221   (run 'hg heads .' to see heads, 'hg merge' to merge)
   195   (run 'hg heads .' to see heads, 'hg merge' to merge)
   222 
   196 
   223 I now have a new heads. Note that the remote head is immutable
   197 I now have a new heads. Note that the remote head is immutable
   224 
   198 
   225   $ hg ttlog
   199   $ hg log
   226   9ca060c80d74: 'SPAM' (published)
   200   9ca060c80d74 (public): SPAM
   227   0cacb48f4482: 'adding fruit' (ready)
   201   0cacb48f4482 (draft): adding fruit
   228   4d5dc8187023: 'adding condiment' (ready)
   202   4d5dc8187023 (draft): adding condiment
   229   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   203   7e82d3f3c2cb (public): Monthy Python Shopping list
   230   $ hg tglog -r "::(9ca060c80d74 + 0cacb48f4482)"
   204   $ hg log -G
   231   o  9ca060c80d74: 'SPAM'
   205   o  9ca060c80d74 (public): SPAM
   232   |
   206   |
   233   | @  0cacb48f4482: 'adding fruit'
   207   | @  0cacb48f4482 (draft): adding fruit
   234   | |
   208   | |
   235   | o  4d5dc8187023: 'adding condiment'
   209   | o  4d5dc8187023 (draft): adding condiment
   236   |/
   210   |/
   237   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
   211   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   238   
   212   
   239 
   213 
   240 instead of merging my head with the new one. I'm going to rebase my work
   214 instead of merging my head with the new one. I'm going to rebase my work
   241 
   215 
   242   $ hg diff
   216   $ hg diff
   243   $ hg rebase -d 9ca060c80d74 -s 4d5dc8187023
   217   $ hg rebase -d 9ca060c80d74 -s 4d5dc8187023
   244   merging shopping
   218   merging shopping
   245   merging shopping
   219   merging shopping
   246   merging shopping
   220 
   247   merging shopping
   221 
   248 
   222 My local work is now rebased on the remote one.
   249 
   223 
   250 My local work is now rebase on the remote one.
   224   $ hg log
   251 
   225   387187ad9bd9 (draft): adding fruit
   252   $ hg kill e7a71e229632 ad97bbd3e37d # XXX fix me instead
   226   dfd3a2d7691e (draft): adding condiment
   253   $ hg ttlog
   227   9ca060c80d74 (public): SPAM
   254   387187ad9bd9: 'adding fruit' (ready)
   228   7e82d3f3c2cb (public): Monthy Python Shopping list
   255   dfd3a2d7691e: 'adding condiment' (ready)
   229   $ hg log -G
   256   9ca060c80d74: 'SPAM' (published)
   230   @  387187ad9bd9 (draft): adding fruit
   257   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   231   |
   258   $ hg tglog -r '::.'
   232   o  dfd3a2d7691e (draft): adding condiment
   259   @  387187ad9bd9: 'adding fruit'
   233   |
   260   |
   234   o  9ca060c80d74 (public): SPAM
   261   o  dfd3a2d7691e: 'adding condiment'
   235   |
   262   |
   236   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   263   o  9ca060c80d74: 'SPAM'
       
   264   |
       
   265   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   266   
   237   
   267 
   238 
   268 Removing changeset
   239 Removing changeset
   269 ------------------------
   240 ------------------------
   270 
   241 
   275   > bus
   246   > bus
   276   > plane
   247   > plane
   277   > boat
   248   > boat
   278   > EOF
   249   > EOF
   279   $ hg ci -m 'transport'
   250   $ hg ci -m 'transport'
   280   $ hg ttlog
   251   $ hg log
   281   d58c77aa15d7: 'transport' (ready)
   252   d58c77aa15d7 (draft): transport
   282   387187ad9bd9: 'adding fruit' (ready)
   253   387187ad9bd9 (draft): adding fruit
   283   dfd3a2d7691e: 'adding condiment' (ready)
   254   dfd3a2d7691e (draft): adding condiment
   284   9ca060c80d74: 'SPAM' (published)
   255   9ca060c80d74 (public): SPAM
   285   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   256   7e82d3f3c2cb (public): Monthy Python Shopping list
   286 
   257 
   287 I have a new commit but I realize that don't want it. (transport shop list does
   258 I have a new commit but I realize that don't want it. (transport shop list does
   288 not fit well in my standard shopping list)
   259 not fit well in my standard shopping list)
   289 
   260 
   290   $ hg kill . # . is for working directory parent.
   261   $ hg kill . # . is for working directory parent.
   291   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
   292   working directory now at 387187ad9bd9
   263   working directory now at 387187ad9bd9
   293 
   264 
   294 The silly changeset is gone.
   265 The silly changeset is gone.
   295 
   266 
   296   $ hg ttlog
   267   $ hg log
   297   387187ad9bd9: 'adding fruit' (ready)
   268   387187ad9bd9 (draft): adding fruit
   298   dfd3a2d7691e: 'adding condiment' (ready)
   269   dfd3a2d7691e (draft): adding condiment
   299   9ca060c80d74: 'SPAM' (published)
   270   9ca060c80d74 (public): SPAM
   300   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   271   7e82d3f3c2cb (public): Monthy Python Shopping list
   301 
   272 
   302 Reordering changeset
   273 Reordering changeset
   303 ------------------------
   274 ------------------------
   304 
   275 
   305 
   276 
   315   > EOF
   286   > EOF
   316   $ hg ci -m 'bathroom stuff' -q # XXX remove the -q
   287   $ hg ci -m 'bathroom stuff' -q # XXX remove the -q
   317 
   288 
   318   $ sed -i'' -e 's/Spam/Spam Spam Spam/g' shopping
   289   $ sed -i'' -e 's/Spam/Spam Spam Spam/g' shopping
   319   $ hg ci -m 'SPAM SPAM'
   290   $ hg ci -m 'SPAM SPAM'
   320   $ hg ttlog
   291   $ hg log
   321   c48f32fb1787: 'SPAM SPAM' (ready)
   292   c48f32fb1787 (draft): SPAM SPAM
   322   8d39a843582d: 'bathroom stuff' (ready)
   293   8d39a843582d (draft): bathroom stuff
   323   387187ad9bd9: 'adding fruit' (ready)
   294   387187ad9bd9 (draft): adding fruit
   324   dfd3a2d7691e: 'adding condiment' (ready)
   295   dfd3a2d7691e (draft): adding condiment
   325   9ca060c80d74: 'SPAM' (published)
   296   9ca060c80d74 (public): SPAM
   326   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   297   7e82d3f3c2cb (public): Monthy Python Shopping list
   327 
   298 
   328 .. note: don't amend changeset 7e82d3f3c2cb or 9ca060c80d74 as they are
   299 .. note: don't amend changeset 7e82d3f3c2cb or 9ca060c80d74 as they are
   329 immutable.
   300 immutable.
   330 
   301 
   331 I now want to push to remote all my change but the bathroom one that i'm not totally happy with yet.
   302 I now want to push to remote all my change but the bathroom one that i'm not totally happy with yet.
   332 
   303 
   333 To be able to push "SPAM SPAM" I need a version of "SPAM SPAM" not children of "bathroom stuff"
   304 To be able to push "SPAM SPAM" I need a version of "SPAM SPAM" not children of "bathroom stuff"
   334 
   305 
   335 You can use rebase or relocate for that:
   306 You can use 'rebase -r' or 'graft -O' for that:
   336 
   307 
   337   $ hg relocate 'p1(8d39a843582d)' --traceback
   308   $ hg up 'p1(8d39a843582d)' # going on "bathroom stuff" parent
       
   309   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   310   $ hg graft -O c48f32fb1787 # moving "SPAM SPAM" to the working directory parent
       
   311   grafting revision 10
   338   merging shopping
   312   merging shopping
   339   $ hg tglog -r '::(. + 8d39a843582d)'
   313   $ hg log -G
   340   @  02e33960e937: 'SPAM SPAM'
   314   @  a2fccc2e7b08 (draft): SPAM SPAM
   341   |
   315   |
   342   | o  8d39a843582d: 'bathroom stuff'
   316   | o  8d39a843582d (draft): bathroom stuff
   343   |/
   317   |/
   344   o  387187ad9bd9: 'adding fruit'
   318   o  387187ad9bd9 (draft): adding fruit
   345   |
   319   |
   346   o  dfd3a2d7691e: 'adding condiment'
   320   o  dfd3a2d7691e (draft): adding condiment
   347   |
   321   |
   348   o  9ca060c80d74: 'SPAM'
   322   o  9ca060c80d74 (public): SPAM
   349   |
   323   |
   350   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
   324   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   351   
   325   
   352 
   326 
   353 We have a new SPAM SPAM version without the bathroom stuff
   327 We have a new SPAM SPAM version without the bathroom stuff
   354 
   328 
   355   $ grep Spam shopping  # enouth spamm
   329   $ grep Spam shopping  # enouth spamm
   358   [1]
   332   [1]
   359   $ hg export .
   333   $ hg export .
   360   # HG changeset patch
   334   # HG changeset patch
   361   # User test
   335   # User test
   362   # Date 0 0
   336   # Date 0 0
   363   # Node ID 02e33960e937ad1bd59241ebdafd7a2494240ddf
   337   # Node ID a2fccc2e7b08bbce6af7255b989453f7089e4cf0
   364   # Parent  387187ad9bd9d8f9a00a9fa804a26231db547429
   338   # Parent  387187ad9bd9d8f9a00a9fa804a26231db547429
   365   SPAM SPAM
   339   SPAM SPAM
   366   
   340   
   367   diff --git a/shopping b/shopping
   341   diff --git a/shopping b/shopping
   368   --- a/shopping
   342   --- a/shopping
   372   +Spam Spam Spam Spam Spam Spam Spam Spam Spam
   346   +Spam Spam Spam Spam Spam Spam Spam Spam Spam
   373    Whizzo butter
   347    Whizzo butter
   374    Albatross
   348    Albatross
   375    Rat (rather a lot)
   349    Rat (rather a lot)
   376 
   350 
       
   351 To make sure I do not push unready changeset by mistake I set the "bathroom
       
   352 stuff" changeset in the secret phase.
       
   353 
       
   354   $ hg phase --force --secret 8d39a843582d
       
   355 
   377 we can now push our change:
   356 we can now push our change:
   378 
   357 
   379   $ hg push -r . remote
   358   $ hg push remote
   380   pushing to $TESTTMP/remote
   359   pushing to $TESTTMP/remote
   381   searching for changes
   360   searching for changes
   382   adding changesets
   361   adding changesets
   383   adding manifests
   362   adding manifests
   384   adding file changes
   363   adding file changes
   385   added 3 changesets with 3 changes to 1 files
   364   added 3 changesets with 3 changes to 1 files
   386 
   365 
   387 for simplicity shake we relocate the bathroom changeset
   366 for simplicity shake we get the bathroom change in line again
   388 
   367 
   389   $ hg relocate -r 8d39a843582d 02e33960e937
   368   $ hg rebase -Dr 8d39a843582d -d a2fccc2e7b08
   390   merging shopping
   369   merging shopping
       
   370   $ hg phase --draft .
   391 
   371 
   392 
   372 
   393 Splitting change
   373 Splitting change
   394 ------------------
   374 ------------------
   395 
   375 
   405 
   385 
   406 
   386 
   407 sharing mutable changeset
   387 sharing mutable changeset
   408 ----------------------------
   388 ----------------------------
   409 
   389 
   410 To share mutable changeset with other just check that both have the "ready"
   390 To share mutable changeset with other just check that the repo you interact
   411 state activated. Otherwise you will get the previously observe behavior where
   391 with is "not publishing". Otherwise you will get the previously observe
   412 exchanged changeset are automatically published.
   392 behavior where exchanged changeset are automatically published.
   413 
   393 
   414   $ cd ../remote
   394   $ cd ../remote
   415   $ hg states 
   395   $ hg -R ../local/ showconfig phases
   416   published
   396 
   417 
   397 the localrepo does not have any specific configuration for `phases.publish`. It is ``true`` by default.
   418 The remote repository have only the immutable "published" state activated. Any
   398 
   419 changeset echanged from "local" to "remote" will be set in the publised state:
   399   $ hg pull local
   420 
   400   pulling from $TESTTMP/local
   421   $ hg -R ../local push -f remote # XXX we should pull but the support is awful
       
   422   pushing to $TESTTMP/remote
       
   423   searching for changes
   401   searching for changes
   424   adding changesets
   402   adding changesets
   425   adding manifests
   403   adding manifests
   426   adding file changes
   404   adding file changes
   427   added 1 changesets with 1 changes to 1 files
   405   added 1 changesets with 1 changes to 1 files
   428   $ hg ttlog
   406   (run 'hg update' to get a working copy)
   429   a3515e5d0332: 'bathroom stuff' published
   407   $ hg log
   430   02e33960e937: 'SPAM SPAM' published
   408   8a79ae8b029e (public): bathroom stuff
   431   387187ad9bd9: 'adding fruit' published
   409   a2fccc2e7b08 (public): SPAM SPAM
   432   dfd3a2d7691e: 'adding condiment' published
   410   387187ad9bd9 (public): adding fruit
   433   9ca060c80d74: 'SPAM' published
   411   dfd3a2d7691e (public): adding condiment
   434   7e82d3f3c2cb: 'Monthy Python Shopping list' published
   412   9ca060c80d74 (public): SPAM
       
   413   7e82d3f3c2cb (public): Monthy Python Shopping list
   435 
   414 
   436 
   415 
   437 
   416 
   438 We do not want to publish the "bathroom changeset". Let's rollback the last transaction
   417 We do not want to publish the "bathroom changeset". Let's rollback the last transaction
   439 
   418 
   440   $ hg rollback
   419   $ hg rollback
   441   repository tip rolled back to revision 4 (undo push)
   420   repository tip rolled back to revision 4 (undo pull)
   442   working directory now based on revision 1
   421   $ hg log
   443   $ hg ttlog
   422   a2fccc2e7b08 (public): SPAM SPAM
   444   02e33960e937: 'SPAM SPAM' published
   423   387187ad9bd9 (public): adding fruit
   445   387187ad9bd9: 'adding fruit' published
   424   dfd3a2d7691e (public): adding condiment
   446   dfd3a2d7691e: 'adding condiment' published
   425   9ca060c80d74 (public): SPAM
   447   9ca060c80d74: 'SPAM' published
   426   7e82d3f3c2cb (public): Monthy Python Shopping list
   448   7e82d3f3c2cb: 'Monthy Python Shopping list' published
   427 
   449   $ rm ../local/.hg/states/published-heads     # XXX USE --exact
   428 Let's make thz local repo "non publishing"
   450   $ hg -R ../local publish 02e33960e937 # XXX FIX THE BUG
   429 
   451 
   430   $ echo "[phases]\npublish=false" >> ../local/.hg/hgrc
   452 To enable the mutable "ready" state in a repository, use the states command.
   431   $ echo "[phases]\npublish=false" >> .hg/hgrc
   453 
   432   $ hg showconfig phases
   454   $ hg states ready
   433   phases.publish=false
   455   $ hg states 
   434   $ hg -R ../local/ showconfig phases
   456   published
   435   phases.publish=false
   457   ready
   436 
   458 
   437 
   459 I can nom exchange mutable changeset between "remote" and "local" repository.
   438 I can now exchange mutable changeset between "remote" and "local" repository.
   460 
   439 
   461   $ hg pull local # XXX We pull too much stuff
   440   $ hg pull local
   462   pulling from $TESTTMP/local
   441   pulling from $TESTTMP/local
   463   searching for changes
   442   searching for changes
   464   adding changesets
   443   adding changesets
   465   adding manifests
   444   adding manifests
   466   adding file changes
   445   adding file changes
   467   added 10 changesets with 10 changes to 1 files (+5 heads)
   446   added 1 changesets with 1 changes to 1 files
   468   (run 'hg heads' to see heads, 'hg merge' to merge)
   447   (run 'hg update' to get a working copy)
   469   $ hg ttlog
   448   $ hg log
   470   a3515e5d0332: 'bathroom stuff' ready
   449   8a79ae8b029e (draft): bathroom stuff
   471   02e33960e937: 'SPAM SPAM' published
   450   a2fccc2e7b08 (public): SPAM SPAM
   472   387187ad9bd9: 'adding fruit' published
   451   387187ad9bd9 (public): adding fruit
   473   dfd3a2d7691e: 'adding condiment' published
   452   dfd3a2d7691e (public): adding condiment
   474   9ca060c80d74: 'SPAM' published
   453   9ca060c80d74 (public): SPAM
   475   7e82d3f3c2cb: 'Monthy Python Shopping list' published
   454   7e82d3f3c2cb (public): Monthy Python Shopping list
   476 
   455 
   477 Rebasing out-of-sync change after update
   456 Rebasing unstable change after update
   478 ----------------------------------------------
   457 ----------------------------------------------
   479 
   458 
   480 Remotely someone add a new changeset on top of our mutable "bathroom" on.
   459 Remotely someone add a new changeset on top of our mutable "bathroom" on.
   481 
   460 
   482   $ hg up a3515e5d0332 -q
   461   $ hg up 8a79ae8b029e -q
   483   $ cat >> shopping << EOF
   462   $ cat >> shopping << EOF
   484   > Giraffe
   463   > Giraffe
   485   > Rhino
   464   > Rhino
   486   > Lion
   465   > Lion
   487   > Bear
   466   > Bear
   488   > EOF
   467   > EOF
   489   $ hg ci -m 'animals' -q # XXX remove the -q
   468   $ hg ci -m 'animals' -q # XXX remove the -q
   490 
   469 
   491 While this time locally, we rebase the updated the "bathroom changeset"
   470 While this time locally, we updated "bathroom changeset"
   492 
   471 
   493   $ cd ../local
   472   $ cd ../local
   494   $ hg up a3515e5d0332 -q
   473   $ hg up 8a79ae8b029e -q
   495   $ sed -i'' -e 's/... More bathroom stuff to come/Bath Robe/' shopping
   474   $ sed -i'' -e 's/... More bathroom stuff to come/Bath Robe/' shopping
   496   $ hg amend
   475   $ hg amend
   497   $ hg tlog
   476   $ hg log
   498   962d3a7d27ad: 'bathroom stuff'
   477   ffa278c50818 (draft): bathroom stuff
   499   02e33960e937: 'SPAM SPAM'
   478   a2fccc2e7b08 (public): SPAM SPAM
   500   387187ad9bd9: 'adding fruit'
   479   387187ad9bd9 (public): adding fruit
   501   dfd3a2d7691e: 'adding condiment'
   480   dfd3a2d7691e (public): adding condiment
   502   9ca060c80d74: 'SPAM'
   481   9ca060c80d74 (public): SPAM
   503   7e82d3f3c2cb: 'Monthy Python Shopping list'
   482   7e82d3f3c2cb (public): Monthy Python Shopping list
   504 
   483 
   505 
   484 
   506 When we pull from remote again we get an unstable state!
   485 When we pull from remote again we get an unstable state!
   507 
   486 
   508   $ hg pull remote
   487   $ hg pull remote
   511   adding changesets
   490   adding changesets
   512   adding manifests
   491   adding manifests
   513   adding file changes
   492   adding file changes
   514   added 1 changesets with 1 changes to 1 files (+1 heads)
   493   added 1 changesets with 1 changes to 1 files (+1 heads)
   515   (run 'hg heads .' to see heads, 'hg merge' to merge)
   494   (run 'hg heads .' to see heads, 'hg merge' to merge)
   516   $ hg tlog
   495   $ hg log
   517   0b061760b677: 'animals'
   496   9ac5d0e790a2 (secret): animals
   518   962d3a7d27ad: 'bathroom stuff'
   497   ffa278c50818 (draft): bathroom stuff
   519   a3515e5d0332: 'bathroom stuff'
   498   8a79ae8b029e (secret): bathroom stuff
   520   02e33960e937: 'SPAM SPAM'
   499   a2fccc2e7b08 (public): SPAM SPAM
   521   387187ad9bd9: 'adding fruit'
   500   387187ad9bd9 (public): adding fruit
   522   dfd3a2d7691e: 'adding condiment'
   501   dfd3a2d7691e (public): adding condiment
   523   9ca060c80d74: 'SPAM'
   502   9ca060c80d74 (public): SPAM
   524   7e82d3f3c2cb: 'Monthy Python Shopping list'
   503   7e82d3f3c2cb (public): Monthy Python Shopping list
       
   504 
       
   505 # XXX Changeset have turned secret because of current implementation of mutable.
   525 
   506 
   526 The new changeset "animal" is based one an old changeset of "bathroom". You can
   507 The new changeset "animal" is based one an old changeset of "bathroom". You can
   527 see both version showing up the log.
   508 see both version showing up the log.
   528 
   509 
   529   $ hg tglog -r '::(962d3a7d27ad + 0b061760b677)'
   510   $ hg glog
   530   o  0b061760b677: 'animals'
   511   o  9ac5d0e790a2 (secret): animals
   531   |
   512   |
   532   | @  962d3a7d27ad: 'bathroom stuff'
   513   | @  ffa278c50818 (draft): bathroom stuff
   533   | |
   514   | |
   534   o |  a3515e5d0332: 'bathroom stuff'
   515   o |  8a79ae8b029e (secret): bathroom stuff
   535   |/
   516   |/
   536   o  02e33960e937: 'SPAM SPAM'
   517   o  a2fccc2e7b08 (public): SPAM SPAM
   537   |
   518   |
   538   o  387187ad9bd9: 'adding fruit'
   519   o  387187ad9bd9 (public): adding fruit
   539   |
   520   |
   540   o  dfd3a2d7691e: 'adding condiment'
   521   o  dfd3a2d7691e (public): adding condiment
   541   |
   522   |
   542   o  9ca060c80d74: 'SPAM'
   523   o  9ca060c80d74 (public): SPAM
   543   |
   524   |
   544   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
   525   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   545   
   526   
   546 
   527 
   547 In hgviewn there is a nice doted relation highlighting 962d3a7d27ad  is a new
   528 In hgview there is a nice doted relation highlighting ffa278c50818  is a new
   548 version of a3515e5d0332. this is not yet ported to graphlog.
   529 version of 8a79ae8b029e. this is not yet ported to graphlog.
   549 
   530 
   550 To resolve this unstable state, you need to relocate 0b061760b677 onto
   531 To resolve this unstable state, you need to rebase 9ac5d0e790a2 onto
   551 962d3a7d27ad the "hg evolve" will make the thinking for you and suggest it to
   532 ffa278c50818 the "hg stabilize" command will make this for you. It has a
   552 you.
   533 --dry-run option to only suggest the next move
   553 
   534 
   554   $ hg evolve
   535   $ hg stabilize --dry-run
   555   hg relocate --rev 0b061760b677 962d3a7d27ad
   536   move:[15] animals
       
   537   atop:[14] bathroom stuff
       
   538   hg rebase -Dr 9ac5d0e790a2 -d ffa278c50818
       
   539 
   556 
   540 
   557 Let's do it
   541 Let's do it
   558 
   542 
   559   $ hg relocate --rev 0b061760b677 962d3a7d27ad
   543   $ hg rebase -Dr 9ac5d0e790a2 -d ffa278c50818
   560   merging shopping
   544   merging shopping
   561 
   545 
   562 The old vesion of bathroom is hidden again now.
   546 The old version of bathroom is hidden again now.
   563 
   547 
   564   $ hg tlog
   548   $ hg log
   565   39a85a192689: 'animals'
   549   437efbcaf700 (secret): animals
   566   962d3a7d27ad: 'bathroom stuff'
   550   ffa278c50818 (draft): bathroom stuff
   567   02e33960e937: 'SPAM SPAM'
   551   a2fccc2e7b08 (public): SPAM SPAM
   568   387187ad9bd9: 'adding fruit'
   552   387187ad9bd9 (public): adding fruit
   569   dfd3a2d7691e: 'adding condiment'
   553   dfd3a2d7691e (public): adding condiment
   570   9ca060c80d74: 'SPAM'
   554   9ca060c80d74 (public): SPAM
   571   7e82d3f3c2cb: 'Monthy Python Shopping list'
   555   7e82d3f3c2cb (public): Monthy Python Shopping list
       
   556 
       
   557 XXX remove me when fixed
       
   558 restore a proper phase for animals
       
   559 
       
   560   $ hg ph -dv 437efbcaf700
       
   561   phase changed for 1 changesets
   572 
   562 
   573 We can push this evolution to remote
   563 We can push this evolution to remote
   574 
   564 
   575   $ hg push -f remote # XXX should not require -f
   565   $ hg push -f remote # XXX should not require -f
   576   pushing to $TESTTMP/remote
   566   pushing to $TESTTMP/remote
   585   $ cd ../remote
   575   $ cd ../remote
   586   $ hg up . # XXX "loulz"
   576   $ hg up . # XXX "loulz"
   587   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   577   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   588   Working directory parent is obsolete
   578   Working directory parent is obsolete
   589 
   579 
   590   $ hg up 39a85a192689
   580   $ hg up 437efbcaf700
   591   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   581   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   592 
   582 
   593 Relocating out-of-sync change after kill
   583 Relocating unstable change after kill
   594 ----------------------------------------------
   584 ----------------------------------------------
   595 
   585 
   596 The remote guy keep working
   586 The remote guy keep working
   597 
   587 
   598   $ sed -i'' -e 's/Spam/Spam Spam Spam Spam/g' shopping
   588   $ sed -i'' -e 's/Spam/Spam Spam Spam Spam/g' shopping
   607   adding changesets
   597   adding changesets
   608   adding manifests
   598   adding manifests
   609   adding file changes
   599   adding file changes
   610   added 1 changesets with 1 changes to 1 files
   600   added 1 changesets with 1 changes to 1 files
   611   (run 'hg update' to get a working copy)
   601   (run 'hg update' to get a working copy)
   612   $ hg tlog
   602   $ hg log
   613   e768beeb835c: 'SPAM SPAM SPAM'
   603   ae45c0c3092a (draft): SPAM SPAM SPAM
   614   39a85a192689: 'animals'
   604   437efbcaf700 (draft): animals
   615   962d3a7d27ad: 'bathroom stuff'
   605   ffa278c50818 (draft): bathroom stuff
   616   02e33960e937: 'SPAM SPAM'
   606   a2fccc2e7b08 (public): SPAM SPAM
   617   387187ad9bd9: 'adding fruit'
   607   387187ad9bd9 (public): adding fruit
   618   dfd3a2d7691e: 'adding condiment'
   608   dfd3a2d7691e (public): adding condiment
   619   9ca060c80d74: 'SPAM'
   609   9ca060c80d74 (public): SPAM
   620   7e82d3f3c2cb: 'Monthy Python Shopping list'
   610   7e82d3f3c2cb (public): Monthy Python Shopping list
   621 
   611 
   622 In the mean time I noticed you can't buy animals in a super market and I kill the animal changeset:
   612 In the mean time I noticed you can't buy animals in a super market and I kill the animal changeset:
   623 
   613 
   624   $ hg kill 39a85a192689 # issue warning here
   614   $ hg kill 437efbcaf700 # XXX issue a warning here
   625   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   615   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   626   working directory now at 962d3a7d27ad
   616   working directory now at ffa278c50818
       
   617 
   627 
   618 
   628 The animals changeset is still displayed because the "SPAM SPAM SPAM" changeset
   619 The animals changeset is still displayed because the "SPAM SPAM SPAM" changeset
   629 is neither dead or obsolete.  My repository is in an unstable state again.
   620 is neither dead or obsolete.  My repository is in an unstable state again.
   630 
   621 
   631   $ hg tlog 
   622   $ hg log
   632   e768beeb835c: 'SPAM SPAM SPAM'
   623   ae45c0c3092a (secret): SPAM SPAM SPAM
   633   39a85a192689: 'animals'
   624   437efbcaf700 (secret): animals
   634   962d3a7d27ad: 'bathroom stuff'
   625   ffa278c50818 (draft): bathroom stuff
   635   02e33960e937: 'SPAM SPAM'
   626   a2fccc2e7b08 (public): SPAM SPAM
   636   387187ad9bd9: 'adding fruit'
   627   387187ad9bd9 (public): adding fruit
   637   dfd3a2d7691e: 'adding condiment'
   628   dfd3a2d7691e (public): adding condiment
   638   9ca060c80d74: 'SPAM'
   629   9ca060c80d74 (public): SPAM
   639   7e82d3f3c2cb: 'Monthy Python Shopping list'
   630   7e82d3f3c2cb (public): Monthy Python Shopping list
   640   $ hg tglog  -r '::e768beeb835c'
   631 
   641   o  e768beeb835c: 'SPAM SPAM SPAM'
   632   $ hg log -r 'unstable()'
   642   |
   633   ae45c0c3092a (secret): SPAM SPAM SPAM
   643   o  39a85a192689: 'animals'
   634 
   644   |
   635   $ hg log -G
   645   @  962d3a7d27ad: 'bathroom stuff'
   636   o  ae45c0c3092a (secret): SPAM SPAM SPAM
   646   |
   637   |
   647   o  02e33960e937: 'SPAM SPAM'
   638   o  437efbcaf700 (secret): animals
   648   |
   639   |
   649   o  387187ad9bd9: 'adding fruit'
   640   @  ffa278c50818 (draft): bathroom stuff
   650   |
   641   |
   651   o  dfd3a2d7691e: 'adding condiment'
   642   o  a2fccc2e7b08 (public): SPAM SPAM
   652   |
   643   |
   653   o  9ca060c80d74: 'SPAM'
   644   o  387187ad9bd9 (public): adding fruit
   654   |
   645   |
   655   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
   646   o  dfd3a2d7691e (public): adding condiment
   656   
   647   |
   657 
   648   o  9ca060c80d74 (public): SPAM
   658 #  $ hg evolve # XXX not ready yet
   649   |
   659 #  hg relocate --rev  e768beeb835c 962d3a7d27ad
   650   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   660 
   651   
   661   $ hg relocate -r  e768beeb835c 'p1(39a85a192689)'
   652 # XXX make this work
       
   653 #  $ hg stabilize --any
       
   654 #  merging shopping
       
   655 
       
   656   $ hg graft -O ae45c0c3092a
       
   657   grafting revision 17
   662   merging shopping
   658   merging shopping
   663 
   659 
   664   $ hg tlog 
   660   $ hg log
   665   19098f8178f3: 'SPAM SPAM SPAM'
   661   20de1fb1cec5 (draft): SPAM SPAM SPAM
   666   962d3a7d27ad: 'bathroom stuff'
   662   ffa278c50818 (draft): bathroom stuff
   667   02e33960e937: 'SPAM SPAM'
   663   a2fccc2e7b08 (public): SPAM SPAM
   668   387187ad9bd9: 'adding fruit'
   664   387187ad9bd9 (public): adding fruit
   669   dfd3a2d7691e: 'adding condiment'
   665   dfd3a2d7691e (public): adding condiment
   670   9ca060c80d74: 'SPAM'
   666   9ca060c80d74 (public): SPAM
   671   7e82d3f3c2cb: 'Monthy Python Shopping list'
   667   7e82d3f3c2cb (public): Monthy Python Shopping list
       
   668 
   672 
   669 
   673 Handling Conflicting amend
   670 Handling Conflicting amend
   674 ----------------------------------------------
   671 ----------------------------------------------
   675 
   672 
   676 We can detect that multiple diverging//conflicting amend have been made. There
   673 We can detect that multiple diverging//conflicting amend have been made. There