doc/simple-tuto.t
changeset 95 5dcece86aeb0
parent 93 1b962aaf0c7d
child 98 8ad5c760c708
equal deleted inserted replaced
94:780a222d547d 95:5dcece86aeb0
   140   +Pear
   140   +Pear
   141   +Apple
   141   +Apple
   142 
   142 
   143 hopefully. I can use hg amend to rewrite my faulty changeset!
   143 hopefully. I can use hg amend to rewrite my faulty changeset!
   144 
   144 
   145   $ sed -i'' s/Bananos/Banana/ shopping
   145   $ sed -i'' -e s/Bananos/Banana/ shopping
   146   $ hg diff
   146   $ hg diff
   147   diff --git a/shopping b/shopping
   147   diff --git a/shopping b/shopping
   148   --- a/shopping
   148   --- a/shopping
   149   +++ b/shopping
   149   +++ b/shopping
   150   @@ -9,6 +9,6 @@
   150   @@ -9,6 +9,6 @@
   210 
   210 
   211 close your eyes
   211 close your eyes
   212 
   212 
   213   $ cd ../remote
   213   $ cd ../remote
   214   $ hg up -q
   214   $ hg up -q
   215   $ sed -i'' 's/Spam/Spam Spam Spam/' shopping
   215   $ sed -i'' -e 's/Spam/Spam Spam Spam/' shopping
   216   $ hg ci -m 'SPAM'
   216   $ hg ci -m 'SPAM'
   217   $ cd ../local
   217   $ cd ../local
   218 
   218 
   219 open your eyes
   219 open your eyes
   220 
   220 
   271   |
   271   |
   272   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
   272   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
   273   
   273   
   274 
   274 
   275 Removing changeset
   275 Removing changeset
   276 ========================
   276 ------------------------
   277 
   277 
   278 I add new item to my list
   278 I add new item to my list
   279 
   279 
   280   $ cat >> shopping << EOF
   280   $ cat >> shopping << EOF
   281   > car
   281   > car
   305   dfd3a2d7691e: 'adding condiment' (ready)
   305   dfd3a2d7691e: 'adding condiment' (ready)
   306   9ca060c80d74: 'SPAM' (published)
   306   9ca060c80d74: 'SPAM' (published)
   307   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   307   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   308 
   308 
   309 Reordering changeset
   309 Reordering changeset
   310 ========================
   310 ------------------------
   311 
   311 
   312 
   312 
   313 We create two changeset.
   313 We create two changeset.
   314 
   314 
   315 
   315 
   316   $ cat >> shopping << EOF
   316   $ cat >> shopping << EOF
       
   317   > Shampoo
   317   > Toothbrush
   318   > Toothbrush
       
   319   > ... More bathroom stuff to come
   318   > Towel
   320   > Towel
   319   > ... More bathroom stuff to come
   321   > Soap
   320   > EOF
   322   > EOF
   321   $ hg ci -m 'bathroom stuff' -q # XXX remove the -q
   323   $ hg ci -m 'bathroom stuff' -q # XXX remove the -q
   322 
   324 
   323   $ sed -i'' 's/Spam/Spam Spam Spam/g' shopping
   325   $ sed -i'' -e 's/Spam/Spam Spam Spam/g' shopping
   324   $ hg ci -m 'SPAM SPAM'
   326   $ hg ci -m 'SPAM SPAM'
   325   $ hg ttlog
   327   $ hg ttlog
   326   d19fa1996cc7: 'SPAM SPAM' (ready)
   328   c48f32fb1787: 'SPAM SPAM' (ready)
   327   e64eb196cfd1: 'bathroom stuff' (ready)
   329   8d39a843582d: 'bathroom stuff' (ready)
   328   387187ad9bd9: 'adding fruit' (ready)
   330   387187ad9bd9: 'adding fruit' (ready)
   329   dfd3a2d7691e: 'adding condiment' (ready)
   331   dfd3a2d7691e: 'adding condiment' (ready)
   330   9ca060c80d74: 'SPAM' (published)
   332   9ca060c80d74: 'SPAM' (published)
   331   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   333   7e82d3f3c2cb: 'Monthy Python Shopping list' (published)
   332 
   334 
   337 
   339 
   338 To be able to push "SPAM SPAM" I need a version of "SPAM SPAM" not children of "bathroom stuff"
   340 To be able to push "SPAM SPAM" I need a version of "SPAM SPAM" not children of "bathroom stuff"
   339 
   341 
   340 You can use rebase or relocate for that:
   342 You can use rebase or relocate for that:
   341 
   343 
   342   $ hg relocate 'p1(e64eb196cfd1)' --traceback
   344   $ hg relocate 'p1(8d39a843582d)' --traceback
   343   merging shopping
   345   merging shopping
   344   $ hg tglog -r '::(. + e64eb196cfd1)'
   346   $ hg tglog -r '::(. + 8d39a843582d)'
   345   @  e96fa9b78e3d: 'SPAM SPAM'
   347   @  02e33960e937: 'SPAM SPAM'
   346   |
   348   |
   347   | o  e64eb196cfd1: 'bathroom stuff'
   349   | o  8d39a843582d: 'bathroom stuff'
   348   |/
   350   |/
   349   o  387187ad9bd9: 'adding fruit'
   351   o  387187ad9bd9: 'adding fruit'
   350   |
   352   |
   351   o  dfd3a2d7691e: 'adding condiment'
   353   o  dfd3a2d7691e: 'adding condiment'
   352   |
   354   |
   363   [1]
   365   [1]
   364   $ hg export .
   366   $ hg export .
   365   # HG changeset patch
   367   # HG changeset patch
   366   # User test
   368   # User test
   367   # Date 0 0
   369   # Date 0 0
   368   # Node ID e96fa9b78e3d2e21b604d4e05582bb1906a9bc59
   370   # Node ID 02e33960e937ad1bd59241ebdafd7a2494240ddf
   369   # Parent  387187ad9bd9d8f9a00a9fa804a26231db547429
   371   # Parent  387187ad9bd9d8f9a00a9fa804a26231db547429
   370   SPAM SPAM
   372   SPAM SPAM
   371   
   373   
   372   diff --git a/shopping b/shopping
   374   diff --git a/shopping b/shopping
   373   --- a/shopping
   375   --- a/shopping
   387   adding changesets
   389   adding changesets
   388   adding manifests
   390   adding manifests
   389   adding file changes
   391   adding file changes
   390   added 3 changesets with 3 changes to 1 files
   392   added 3 changesets with 3 changes to 1 files
   391 
   393 
       
   394 for simplicity shake we relocate the bathroom changeset
       
   395 
       
   396   $ hg relocate -r 8d39a843582d 02e33960e937
       
   397   merging shopping
       
   398 
       
   399 
       
   400 Splitting change
       
   401 ------------------
       
   402 
       
   403 To be done (currently achieve with "two commit + debugobsolete")
       
   404 
       
   405 Collapsing change
       
   406 ------------------
       
   407 
       
   408 To be done (currently achieve with "revert + debugobsolete" or "rebase --collapse")
       
   409 
   392 collaboration
   410 collaboration
   393 ====================
   411 ====================
   394 
   412 
   395 
   413 
   396 
   414 sharing mutable changeset
   397 We create a central repo (because most workflow include this central repo
   415 ----------------------------
   398 
   416 
   399   $ cd ..
   417 To share mutable changeset with other just check that both have the "ready"
   400   $ hg init central
   418 state activated. Otherwise you will get the previously observe behavior where
       
   419 exchanged changeset are automatically published.
       
   420 
       
   421   $ cd ../remote
       
   422   $ hg states 
       
   423   published
       
   424 
       
   425 The remote repository have only the immutable "published" state activated. Any
       
   426 changeset echanged from "local" to "remote" will be set in the publised state:
       
   427 
       
   428   $ hg -R ../local push -f remote # XXX we should pull but the support is awful
       
   429   pushing to $TESTTMP/remote
       
   430   searching for changes
       
   431   adding changesets
       
   432   adding manifests
       
   433   adding file changes
       
   434   added 1 changesets with 1 changes to 1 files
       
   435   $ hg ttlog
       
   436   a3515e5d0332: 'bathroom stuff' published
       
   437   02e33960e937: 'SPAM SPAM' published
       
   438   387187ad9bd9: 'adding fruit' published
       
   439   dfd3a2d7691e: 'adding condiment' published
       
   440   9ca060c80d74: 'SPAM' published
       
   441   7e82d3f3c2cb: 'Monthy Python Shopping list' published
       
   442 
       
   443 
       
   444 
       
   445 We do not want to publish the "bathroom changeset". Let's rollback the last transaction
       
   446 
       
   447   $ hg rollback
       
   448   repository tip rolled back to revision 4 (undo push)
       
   449   working directory now based on revision 1
       
   450   $ hg ttlog
       
   451   02e33960e937: 'SPAM SPAM' published
       
   452   387187ad9bd9: 'adding fruit' published
       
   453   dfd3a2d7691e: 'adding condiment' published
       
   454   9ca060c80d74: 'SPAM' published
       
   455   7e82d3f3c2cb: 'Monthy Python Shopping list' published
       
   456   $ rm ../local/.hg/states/published-heads     # XXX USE --exact
       
   457   $ hg -R ../local publish 02e33960e937 # XXX FIX THE BUG
       
   458 
       
   459 To enable the mutable "ready" state in a repository, use the states command.
       
   460 
       
   461   $ hg states ready
       
   462   $ hg states 
       
   463   published
       
   464   ready
       
   465 
       
   466 I can nom exchange mutable changeset between "remote" and "local" repository.
       
   467 
       
   468   $ hg pull local # XXX We pull too much stuff
       
   469   pulling from $TESTTMP/local
       
   470   searching for changes
       
   471   adding changesets
       
   472   adding manifests
       
   473   adding file changes
       
   474   added 10 changesets with 10 changes to 1 files (+5 heads)
       
   475   (run 'hg heads' to see heads, 'hg merge' to merge)
       
   476   $ hg ttlog
       
   477   a3515e5d0332: 'bathroom stuff' ready
       
   478   02e33960e937: 'SPAM SPAM' published
       
   479   387187ad9bd9: 'adding fruit' published
       
   480   dfd3a2d7691e: 'adding condiment' published
       
   481   9ca060c80d74: 'SPAM' published
       
   482   7e82d3f3c2cb: 'Monthy Python Shopping list' published
       
   483 
       
   484 Rebasing out-of-sync change after update
       
   485 ----------------------------------------------
       
   486 
       
   487 Remotely someone add a new changeset on top of our mutable "bathroom" on.
       
   488 
       
   489   $ hg up a3515e5d0332 -q
       
   490   $ cat >> shopping << EOF
       
   491   > Giraffe
       
   492   > Rhino
       
   493   > Lion
       
   494   > Bear
       
   495   > EOF
       
   496   $ hg ci -m 'animals' -q # XXX remove the -q
       
   497 
       
   498 While this time locally, we rebase the updated the "bathroom changeset"
       
   499 
       
   500   $ cd ../local
       
   501   $ hg up a3515e5d0332 -q
       
   502   $ sed -i'' -e 's/... More bathroom stuff to come/Bath Robe/' shopping
       
   503   $ hg amend
       
   504   $ hg tlog
       
   505   962d3a7d27ad: 'bathroom stuff'
       
   506   02e33960e937: 'SPAM SPAM'
       
   507   387187ad9bd9: 'adding fruit'
       
   508   dfd3a2d7691e: 'adding condiment'
       
   509   9ca060c80d74: 'SPAM'
       
   510   7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   511 
       
   512 
       
   513 When we pull from remote again we get an unstable state!
       
   514 
       
   515   $ hg pull remote
       
   516   pulling from $TESTTMP/remote
       
   517   searching for changes
       
   518   adding changesets
       
   519   adding manifests
       
   520   adding file changes
       
   521   added 1 changesets with 1 changes to 1 files (+1 heads)
       
   522   (run 'hg heads .' to see heads, 'hg merge' to merge)
       
   523   $ hg tlog
       
   524   0b061760b677: 'animals'
       
   525   962d3a7d27ad: 'bathroom stuff'
       
   526   a3515e5d0332: 'bathroom stuff'
       
   527   02e33960e937: 'SPAM SPAM'
       
   528   387187ad9bd9: 'adding fruit'
       
   529   dfd3a2d7691e: 'adding condiment'
       
   530   9ca060c80d74: 'SPAM'
       
   531   7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   532 
       
   533 The new changeset "animal" is based one an old changeset of "bathroom". You can
       
   534 see both version showing up the log.
       
   535 
       
   536   $ hg tglog -r '::(962d3a7d27ad + 0b061760b677)'
       
   537   o  0b061760b677: 'animals'
       
   538   |
       
   539   | @  962d3a7d27ad: 'bathroom stuff'
       
   540   | |
       
   541   o |  a3515e5d0332: 'bathroom stuff'
       
   542   |/
       
   543   o  02e33960e937: 'SPAM SPAM'
       
   544   |
       
   545   o  387187ad9bd9: 'adding fruit'
       
   546   |
       
   547   o  dfd3a2d7691e: 'adding condiment'
       
   548   |
       
   549   o  9ca060c80d74: 'SPAM'
       
   550   |
       
   551   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   552   
       
   553 
       
   554 In hgviewn there is a nice doted relation highlighting 962d3a7d27ad  is a new
       
   555 version of a3515e5d0332. this is not yet ported to graphlog.
       
   556 
       
   557 To resolve this unstable state, you need to relocate 0b061760b677 onto
       
   558 962d3a7d27ad the "hg evolve" will make the thinking for you and suggest it to
       
   559 you.
       
   560 
       
   561   $ hg evolve
       
   562   hg relocate --rev 0b061760b677 962d3a7d27ad
       
   563 
       
   564 Let's do it
       
   565 
       
   566   $ hg relocate --rev 0b061760b677 962d3a7d27ad
       
   567   merging shopping
       
   568 
       
   569 The old vesion of bathroom is hidden again now.
       
   570 
       
   571   $ hg tlog
       
   572   39a85a192689: 'animals'
       
   573   962d3a7d27ad: 'bathroom stuff'
       
   574   02e33960e937: 'SPAM SPAM'
       
   575   387187ad9bd9: 'adding fruit'
       
   576   dfd3a2d7691e: 'adding condiment'
       
   577   9ca060c80d74: 'SPAM'
       
   578   7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   579 
       
   580 We can push this evolution to remote
       
   581 
       
   582   $ hg push -f remote # XXX should not require -f
       
   583   pushing to $TESTTMP/remote
       
   584   searching for changes
       
   585   adding changesets
       
   586   adding manifests
       
   587   adding file changes
       
   588   added 2 changesets with 2 changes to 1 files (+1 heads)
       
   589 
       
   590 remote get a warning that current working directory is based on an obsolete changeset
       
   591 
       
   592   $ cd ../remote
       
   593   $ hg up . # XXX "loulz"
       
   594   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   595   Working directory parent is obsolete
       
   596 
       
   597   $ hg up 39a85a192689
       
   598   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   599 
       
   600 Relocating out-of-sync change after kill
       
   601 ----------------------------------------------
       
   602 
       
   603 The remote guy keep working
       
   604 
       
   605   $ sed -i'' -e 's/Spam/Spam Spam Spam Spam/g' shopping
       
   606   $ hg commit -m "SPAM SPAM SPAM"
       
   607 
       
   608 Work I can keep getting localy
       
   609 
       
   610   $ cd ../local
       
   611   $ hg pull remote
       
   612   pulling from $TESTTMP/remote
       
   613   searching for changes
       
   614   adding changesets
       
   615   adding manifests
       
   616   adding file changes
       
   617   added 1 changesets with 1 changes to 1 files
       
   618   (run 'hg update' to get a working copy)
       
   619   $ hg tlog
       
   620   e768beeb835c: 'SPAM SPAM SPAM'
       
   621   39a85a192689: 'animals'
       
   622   962d3a7d27ad: 'bathroom stuff'
       
   623   02e33960e937: 'SPAM SPAM'
       
   624   387187ad9bd9: 'adding fruit'
       
   625   dfd3a2d7691e: 'adding condiment'
       
   626   9ca060c80d74: 'SPAM'
       
   627   7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   628 
       
   629 In the mean time I noticed you can't buy animals in a super market and I kill the animal changeset:
       
   630 
       
   631   $ hg kill 39a85a192689 # issue warning here
       
   632   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   633   working directory now at 962d3a7d27ad
       
   634 
       
   635 The animals changeset is still displayed because the "SPAM SPAM SPAM" changeset
       
   636 is neither dead or obsolete.  My repository is in an unstable state again.
       
   637 
       
   638   $ hg tlog 
       
   639   e768beeb835c: 'SPAM SPAM SPAM'
       
   640   39a85a192689: 'animals'
       
   641   962d3a7d27ad: 'bathroom stuff'
       
   642   02e33960e937: 'SPAM SPAM'
       
   643   387187ad9bd9: 'adding fruit'
       
   644   dfd3a2d7691e: 'adding condiment'
       
   645   9ca060c80d74: 'SPAM'
       
   646   7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   647   $ hg tglog  -r '::e768beeb835c'
       
   648   o  e768beeb835c: 'SPAM SPAM SPAM'
       
   649   |
       
   650   o  39a85a192689: 'animals'
       
   651   |
       
   652   @  962d3a7d27ad: 'bathroom stuff'
       
   653   |
       
   654   o  02e33960e937: 'SPAM SPAM'
       
   655   |
       
   656   o  387187ad9bd9: 'adding fruit'
       
   657   |
       
   658   o  dfd3a2d7691e: 'adding condiment'
       
   659   |
       
   660   o  9ca060c80d74: 'SPAM'
       
   661   |
       
   662   o  7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   663   
       
   664 
       
   665 #  $ hg evolve # XXX not ready yet
       
   666 #  hg relocate --rev  e768beeb835c 962d3a7d27ad
       
   667 
       
   668   $ hg relocate -r  e768beeb835c 'p1(39a85a192689)'
       
   669   merging shopping
       
   670 
       
   671   $ hg tlog 
       
   672   19098f8178f3: 'SPAM SPAM SPAM'
       
   673   962d3a7d27ad: 'bathroom stuff'
       
   674   02e33960e937: 'SPAM SPAM'
       
   675   387187ad9bd9: 'adding fruit'
       
   676   dfd3a2d7691e: 'adding condiment'
       
   677   9ca060c80d74: 'SPAM'
       
   678   7e82d3f3c2cb: 'Monthy Python Shopping list'
       
   679 
       
   680 Handling Conflicting amend
       
   681 ----------------------------------------------
       
   682 
       
   683 We can detect that multiple diverging//conflicting amend have been made. There
       
   684 will be a "evol-merge" command to merge conflicting amend
       
   685 
       
   686 collaboration
       
   687 ====================
       
   688 
       
   689 Turning changeset immutable
       
   690 ----------------------------------------------
       
   691 
       
   692 * push on published//only repo
       
   693 
       
   694 * tag
       
   695 
       
   696 * explicite published command
       
   697 
       
   698 Handling Invalid amend on published changeset
       
   699 ----------------------------------------------
       
   700 
       
   701 you can't amend published changeset. changeset that do this will have an "invalid amend" obsolete-status
       
   702