tests/test-tutorial.t
changeset 2831 eda8eb561134
parent 2826 93588d219f2f
child 2834 38db1466c6fb
equal deleted inserted replaced
2820:fb795bdaa06c 2831:eda8eb561134
     1 
     1 
     2 Initial setup
     2 Initial setup
     3 -------------
     3 -------------
     4 
     4 
     5 This Mercurial configuration example is used for testing.
     5 This Mercurial configuration example is used for testing.
       
     6 
     6 .. Various setup
     7 .. Various setup
     7 
     8 
     8   $ cat >> $HGRCPATH << EOF
     9   $ cat >> $HGRCPATH << EOF
     9   > [ui]
    10   > [ui]
    10   > # This is change the default output of log for clear tutorial
    11   > # This is change the default output of log for clear tutorial
   156   o  4d5dc8187023 (draft): adding condiment
   157   o  4d5dc8187023 (draft): adding condiment
   157   |
   158   |
   158   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   159   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   159   
   160   
   160 
   161 
   161 hopefully. I can use `hg commit --amend` to rewrite my faulty changeset!
   162 Hopefully. I can use `hg commit --amend` to rewrite my faulty changeset!
   162 
   163 
   163   $ sed -i'' -e s/Bananos/Banana/ shopping
   164   $ sed -i'' -e s/Bananos/Banana/ shopping
   164   $ hg diff
   165   $ hg diff
   165   diff --git a/shopping b/shopping
   166   diff --git a/shopping b/shopping
   166   --- a/shopping
   167   --- a/shopping
   205   +Apple
   206   +Apple
   206 
   207 
   207 Getting rid of branchy history
   208 Getting rid of branchy history
   208 ----------------------------------
   209 ----------------------------------
   209 
   210 
   210 While I was working on my list. someone made a change remotely.
   211 While I was working on my list. Someone made a change remotely.
   211 
   212 
   212   $ cd ../remote
   213   $ cd ../remote
   213   $ hg up -q
   214   $ hg up -q
   214   $ sed -i'' -e 's/Spam/Spam Spam Spam/' shopping
   215   $ sed -i'' -e 's/Spam/Spam Spam Spam/' shopping
   215   $ hg ci -m 'SPAM'
   216   $ hg ci -m 'SPAM'
   224   adding manifests
   225   adding manifests
   225   adding file changes
   226   adding file changes
   226   added 1 changesets with 1 changes to 1 files (+1 heads)
   227   added 1 changesets with 1 changes to 1 files (+1 heads)
   227   (run 'hg heads' to see heads, 'hg merge' to merge)
   228   (run 'hg heads' to see heads, 'hg merge' to merge)
   228 
   229 
   229 I now have a new heads. Note that this remote head is immutable
   230 I now have a new head. Note that this remote head is immutable.
   230 
   231 
   231   $ hg log -G
   232   $ hg log -G
   232   o  9ca060c80d74 (public): SPAM
   233   o  9ca060c80d74 (public): SPAM
   233   |
   234   |
   234   | @  9d0363b81950 (draft): adding fruit
   235   | @  9d0363b81950 (draft): adding fruit
   236   | o  4d5dc8187023 (draft): adding condiment
   237   | o  4d5dc8187023 (draft): adding condiment
   237   |/
   238   |/
   238   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   239   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   239   
   240   
   240 
   241 
   241 instead of merging my head with the new one. I'm going to rebase my work
   242 Instead of merging my head with the new one. I'm going to rebase my work
   242 
   243 
   243   $ hg diff
   244   $ hg diff
   244   $ hg rebase --dest 9ca060c80d74 --source 4d5dc8187023
   245   $ hg rebase --dest 9ca060c80d74 --source 4d5dc8187023
   245   rebasing 1:4d5dc8187023 "adding condiment"
   246   rebasing 1:4d5dc8187023 "adding condiment"
   246   merging shopping
   247   merging shopping
   261   
   262   
   262 
   263 
   263 Removing changesets
   264 Removing changesets
   264 ------------------------
   265 ------------------------
   265 
   266 
   266 I add new item to my list
   267 I add new items to my list.
   267 
   268 
   268   $ cat >> shopping << EOF
   269   $ cat >> shopping << EOF
   269   > car
   270   > car
   270   > bus
   271   > bus
   271   > plane
   272   > plane
   282   o  9ca060c80d74 (public): SPAM
   283   o  9ca060c80d74 (public): SPAM
   283   |
   284   |
   284   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   285   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   285   
   286   
   286 
   287 
   287 I have a new commit but I realize that don't want it. (transport shop list does
   288 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)
   289 not fit well in my standard shopping list)
   289 
   290 
   290   $ hg prune . # "." is for working directory parent
   291   $ hg prune . # "." is for working directory parent
   291   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   292   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   292   working directory now at 41aff6a42b75
   293   working directory now at 41aff6a42b75
   511 -----------------------
   512 -----------------------
   512 Collaboration
   513 Collaboration
   513 -----------------------
   514 -----------------------
   514 
   515 
   515 
   516 
   516 sharing mutable changesets
   517 Sharing mutable changesets
   517 ----------------------------
   518 ----------------------------
   518 
   519 
   519 To share mutable changesets with others, just check that the repo you interact
   520 To share mutable changesets with others, just check that the repo you interact
   520 with is "not publishing". Otherwise you will get the previously observe
   521 with is "not publishing". Otherwise you will get the previously observe
   521 behavior where exchanged changeset are automatically published.
   522 behavior where exchanged changeset are automatically published.
   522 
   523 
   523   $ cd ../remote
   524   $ cd ../remote
   524   $ hg -R ../local/ showconfig phases
   525   $ hg -R ../local/ showconfig phases
   525   [1]
   526   [1]
   526 
   527 
   527 the localrepo does not have any specific configuration for `phases.publish`. It
   528 The localrepo does not have any specific configuration for `phases.publish`. It
   528 is ``true`` by default.
   529 is ``true`` by default.
   529 
   530 
   530   $ hg pull local
   531   $ hg pull local
   531   pulling from $TESTTMP/local (glob)
   532   pulling from $TESTTMP/local (glob)
   532   searching for changes
   533   searching for changes
   548   @  9ca060c80d74 (public): SPAM
   549   @  9ca060c80d74 (public): SPAM
   549   |
   550   |
   550   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   551   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   551   
   552   
   552 
   553 
   553 
       
   554 
       
   555 We do not want to publish the "bathroom changeset". Let's rollback the last transaction.
   554 We do not want to publish the "bathroom changeset". Let's rollback the last transaction.
   556 
   555 
   557 .. Warning: Rollback is actually a dangerous kind of internal command that is deprecated and should not be exposed to user. Please forget you read about it until someone fix this tutorial.
   556 .. Warning: Rollback is actually a dangerous kind of internal command that is deprecated and should not be exposed to user. Please forget you read about it until someone fix this tutorial.
   558 
   557 
   559   $ hg rollback
   558   $ hg rollback
   568   @  9ca060c80d74 (public): SPAM
   567   @  9ca060c80d74 (public): SPAM
   569   |
   568   |
   570   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   569   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   571   
   570   
   572 
   571 
   573 Let's make the local repo "non publishing"
   572 Let's make the local repo "non publishing".
   574 
   573 
   575   $ echo '[phases]' >> ../local/.hg/hgrc
   574   $ echo '[phases]' >> ../local/.hg/hgrc
   576   $ echo 'publish=false' >> ../local/.hg/hgrc
   575   $ echo 'publish=false' >> ../local/.hg/hgrc
   577   $ echo '[phases]' >> .hg/hgrc
   576   $ echo '[phases]' >> .hg/hgrc
   578   $ echo 'publish=false' >> .hg/hgrc
   577   $ echo 'publish=false' >> .hg/hgrc
   639   o  9ca060c80d74 (public): SPAM
   638   o  9ca060c80d74 (public): SPAM
   640   |
   639   |
   641   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   640   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   642   
   641   
   643 
   642 
   644 
       
   645 When we pull from remote again we get an unstable state!
   643 When we pull from remote again we get an unstable state!
   646 
   644 
   647   $ hg pull remote
   645   $ hg pull remote
   648   pulling from $TESTTMP/remote (glob)
   646   pulling from $TESTTMP/remote (glob)
   649   searching for changes
   647   searching for changes
   690   abort: push includes unstable changeset: bf1b0d202029!
   688   abort: push includes unstable changeset: bf1b0d202029!
   691   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   689   (use 'hg evolve' to get a stable history or --force to ignore warnings)
   692   [255]
   690   [255]
   693  
   691  
   694 
   692 
   695 
       
   696 
       
   697 To resolve this unstable state, you need to rebase bf1b0d202029 onto
   693 To resolve this unstable state, you need to rebase bf1b0d202029 onto
   698 a44c85f957d3. The `hg evolve` command will do this for you.
   694 a44c85f957d3. The `hg evolve` command will do this for you.
   699 
   695 
   700 It has a --dry-run option to only suggest the next move.
   696 It has a --dry-run option to only suggest the next move.
   701 
   697 
   728   o  9ca060c80d74 (public): SPAM
   724   o  9ca060c80d74 (public): SPAM
   729   |
   725   |
   730   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   726   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   731   
   727   
   732 
   728 
   733 
   729 We can push this evolution to remote.
   734 We can push this evolution to remote
       
   735 
   730 
   736   $ hg push remote
   731   $ hg push remote
   737   pushing to $TESTTMP/remote (glob)
   732   pushing to $TESTTMP/remote (glob)
   738   searching for changes
   733   searching for changes
   739   adding changesets
   734   adding changesets
   741   adding file changes
   736   adding file changes
   742   added 2 changesets with 2 changes to 1 files (+1 heads)
   737   added 2 changesets with 2 changes to 1 files (+1 heads)
   743   3 new obsolescence markers
   738   3 new obsolescence markers
   744   obsoleted 2 changesets
   739   obsoleted 2 changesets
   745 
   740 
   746 remote get a warning that current working directory is based on an obsolete changeset
   741 Remote get a warning that current working directory is based on an obsolete
       
   742 changeset.
   747 
   743 
   748   $ cd ../remote
   744   $ cd ../remote
   749   $ hg pull local # we up again to trigger the warning. it was displayed during the push
   745   $ hg pull local # we up again to trigger the warning. it was displayed during the push
   750   pulling from $TESTTMP/local (glob)
   746   pulling from $TESTTMP/local (glob)
   751   searching for changes
   747   searching for changes
   752   no changes found
   748   no changes found
   753   working directory parent is obsolete! (bf1b0d202029)
   749   working directory parent is obsolete! (bf1b0d202029)
   754   (use 'hg evolve' to update to its successor: ee942144f952)
   750   (use 'hg evolve' to update to its successor: ee942144f952)
   755 
   751 
   756 now let's see where we are, and update to the successor
   752 Now let's see where we are, and update to the successor.
   757 
   753 
   758   $ hg parents
   754   $ hg parents
   759   bf1b0d202029 (draft): animals
   755   bf1b0d202029 (draft): animals
   760   working directory parent is obsolete! (bf1b0d202029)
   756   working directory parent is obsolete! (bf1b0d202029)
   761   (use 'hg evolve' to update to its successor: ee942144f952)
   757   (use 'hg evolve' to update to its successor: ee942144f952)
   765   working directory is now at ee942144f952
   761   working directory is now at ee942144f952
   766 
   762 
   767 Relocating unstable change after prune
   763 Relocating unstable change after prune
   768 ----------------------------------------------
   764 ----------------------------------------------
   769 
   765 
   770 The remote guy keep working
   766 The remote guy keeps working.
   771 
   767 
   772   $ sed -i'' -e 's/Spam/Spam Spam Spam Spam/g' shopping
   768   $ sed -i'' -e 's/Spam/Spam Spam Spam Spam/g' shopping
   773   $ hg commit -m "SPAM SPAM SPAM"
   769   $ hg commit -m "SPAM SPAM SPAM"
   774 
   770 
   775 I'm pulling its work locally.
   771 I'm pulling its work locally.
   809   1 changesets pruned
   805   1 changesets pruned
   810   1 new unstable changesets
   806   1 new unstable changesets
   811 
   807 
   812 
   808 
   813 The animals changeset is still displayed because the "SPAM SPAM SPAM" changeset
   809 The animals changeset is still displayed because the "SPAM SPAM SPAM" changeset
   814 is neither dead or obsolete.  My repository is in an unstable state again.
   810 is neither dead or obsolete. My repository is in an unstable state again.
   815 
   811 
   816   $ hg log -G
   812   $ hg log -G
   817   o  99f039c5ec9e (draft): SPAM SPAM SPAM
   813   o  99f039c5ec9e (draft): SPAM SPAM SPAM
   818   |
   814   |
   819   x  ee942144f952 (draft): animals
   815   x  ee942144f952 (draft): animals
   828   |
   824   |
   829   o  9ca060c80d74 (public): SPAM
   825   o  9ca060c80d74 (public): SPAM
   830   |
   826   |
   831   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   827   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   832   
   828   
   833 
       
   834   $ hg log -r 'unstable()'
   829   $ hg log -r 'unstable()'
   835   99f039c5ec9e (draft): SPAM SPAM SPAM
   830   99f039c5ec9e (draft): SPAM SPAM SPAM
   836 
   831 
   837   $ hg evolve
   832   $ hg evolve
   838   move:[17] SPAM SPAM SPAM
   833   move:[17] SPAM SPAM SPAM
   853   |
   848   |
   854   o  9ca060c80d74 (public): SPAM
   849   o  9ca060c80d74 (public): SPAM
   855   |
   850   |
   856   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   851   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   857   
   852   
   858 
       
   859 
       
   860 Handling Divergent amend
   853 Handling Divergent amend
   861 ----------------------------------------------
   854 ----------------------------------------------
   862 
   855 
   863 We can detect that multiple diverging amendments have been made.
   856 We can detect that multiple diverging amendments have been made.
   864 The `evolve` command can solve this situation. But all corner case are not
   857 The `evolve` command can solve this situation. But all corner case are not