tests/test-tutorial.t
changeset 775 0961a7eb82c4
parent 774 03844e1fbfe6
child 803 b96d51a357bd
equal deleted inserted replaced
763:966e2659e989 775:0961a7eb82c4
     5 This Mercurial configuration example is used for testing.
     5 This Mercurial configuration example is used for testing.
     6 .. Various setup
     6 .. Various setup
     7 
     7 
     8   $ cat >> $HGRCPATH << EOF
     8   $ cat >> $HGRCPATH << EOF
     9   > [ui]
     9   > [ui]
       
    10   > # This is change the default output of log for clear tutorial
    10   > logtemplate ="{node|short} ({phase}): {desc}\n"
    11   > logtemplate ="{node|short} ({phase}): {desc}\n"
    11   > [diff]
    12   > [diff]
       
    13   > # use "git" diff format, clearer and smarter format
    12   > git = 1
    14   > git = 1
    13   > [alias]
    15   > [alias]
    14   > # "-d '0 0'" means that the new commit will be at January 1st 1970.
    16   > # "-d '0 0'" means that the new commit will be at January 1st 1970.
    15   > # This is used for stable hash during test
    17   > # This is used for stable hash during test
       
    18   > # (this tutorial is automatically tested.)
    16   > amend = amend -d '0 0'
    19   > amend = amend -d '0 0'
    17   > EOF
    20   > EOF
    18 
    21 
    19   $ hg init local
    22   $ hg init local
    20   $ cat >> local/.hg/hgrc << EOF
    23   $ cat >> local/.hg/hgrc << EOF
    42 
    45 
    43 This tutorial uses the following configuration for Mercurial:
    46 This tutorial uses the following configuration for Mercurial:
    44 
    47 
    45 A compact log template with phase data:
    48 A compact log template with phase data:
    46 
    49 
    47   $ hg showconfig ui
    50   $ hg showconfig ui | grep log
    48   ui.slash=True
       
    49   ui.logtemplate="{node|short} ({phase}): {desc}\n"
    51   ui.logtemplate="{node|short} ({phase}): {desc}\n"
    50 
    52 
    51 Improved git format diff:
    53 Improved git format diff:
    52 
    54 
    53   $ hg showconfig diff
    55   $ hg showconfig diff
    55 
    57 
    56 And of course, we enable the experimental extensions for mutable history:
    58 And of course, we enable the experimental extensions for mutable history:
    57 
    59 
    58   $ cat >> $HGRCPATH <<EOF
    60   $ cat >> $HGRCPATH <<EOF
    59   > [extensions]
    61   > [extensions]
       
    62   > evolve = $TESTDIR/../hgext/evolve.py
       
    63   > # enabling rebase is also needed for now
    60   > rebase =
    64   > rebase =
    61   > evolve = $TESTDIR/../hgext/evolve.py
       
    62   > EOF
    65   > EOF
    63 
    66 
    64 -----------------------
    67 -----------------------
    65 Single Developer Usage
    68 Single Developer Usage
    66 -----------------------
    69 -----------------------
   202   +Apple
   205   +Apple
   203 
   206 
   204 Getting rid of branchy history
   207 Getting rid of branchy history
   205 ----------------------------------
   208 ----------------------------------
   206 
   209 
   207 While I was working on my list. someone help made a change remotly.
   210 While I was working on my list. someone made a change remotly.
   208 
   211 
   209   $ cd ../remote
   212   $ cd ../remote
   210   $ hg up -q
   213   $ hg up -q
   211   $ sed -i'' -e 's/Spam/Spam Spam Spam/' shopping
   214   $ sed -i'' -e 's/Spam/Spam Spam Spam/' shopping
   212   $ hg ci -m 'SPAM'
   215   $ hg ci -m 'SPAM'
   236   
   239   
   237 
   240 
   238 instead of merging my head with the new one. I'm going to rebase my work
   241 instead of merging my head with the new one. I'm going to rebase my work
   239 
   242 
   240   $ hg diff
   243   $ hg diff
   241   $ hg rebase -d 9ca060c80d74 -s 4d5dc8187023
   244   $ hg rebase --dest 9ca060c80d74 --source 4d5dc8187023
   242   merging shopping
   245   merging shopping
   243   merging shopping
   246   merging shopping
   244 
   247 
   245 
   248 
   246 My local work is now rebased on the remote one.
   249 My local work is now rebased on the remote one.
   280   
   283   
   281 
   284 
   282 I have a new commit but I realize that don't want it. (transport shop list does
   285 I have a new commit but I realize that don't want it. (transport shop list does
   283 not fit well in my standard shopping list)
   286 not fit well in my standard shopping list)
   284 
   287 
   285   $ hg prune . # . is for working directory parent
   288   $ hg prune . # "." is for working directory parent
   286   1 changesets pruned
   289   1 changesets pruned
   287   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   290   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   288   working directory now at 41aff6a42b75
   291   working directory now at 41aff6a42b75
   289 
   292 
   290 The silly changeset is gone.
   293 The silly changeset is gone.
   329   o  9ca060c80d74 (public): SPAM
   332   o  9ca060c80d74 (public): SPAM
   330   |
   333   |
   331   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   334   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   332   
   335   
   333 
   336 
   334 .. note: We can't amend changeset 7e82d3f3c2cb or 9ca060c80d74 as they are immutable.
   337 .. note:: We can't amend changeset 7e82d3f3c2cb or 9ca060c80d74 as they are immutable.
   335 
   338 
   336 I now want to push to remote all my changes except the bathroom one, which I'm not
   339  I now want to push to remote all my changes except the bathroom one, which I'm
   337 totally happy with yet. To be able to push "SPAM SPAM" I need a version of "SPAM SPAM" which is not a child of
   340  not totally happy with yet. To be able to push "SPAM SPAM" I need a version of
   338 "bathroom stuff"
   341  "SPAM SPAM" which is not a child of "bathroom stuff"
   339 
   342 
   340 You can use 'rebase -r' or 'grab' for that:
   343 You can use the 'grab' alias for that.
       
   344 
       
   345 .. note: grab is an alias for `hg rebase --dest . --rev <target>; hg up <there>`
   341 
   346 
   342   $ hg up 'p1(10b8aeaa8cc8)' # going on "bathroom stuff" parent
   347   $ hg up 'p1(10b8aeaa8cc8)' # going on "bathroom stuff" parent
   343   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   348   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   344   $ hg rebase --rev fac207dec9f5 --dest . # moving "SPAM SPAM" to the working directory parent
   349   $ hg grab fac207dec9f5 # moving "SPAM SPAM" to the working directory parent
   345   merging shopping
   350   merging shopping
   346   $ hg up tip
       
   347   ? files updated, 0 files merged, 0 files removed, 0 files unresolved (glob)
   351   ? files updated, 0 files merged, 0 files removed, 0 files unresolved (glob)
   348   $ hg log -G
   352   $ hg log -G
   349   @  a224f2a4fb9f (draft): SPAM SPAM
   353   @  a224f2a4fb9f (draft): SPAM SPAM
   350   |
   354   |
   351   | o  10b8aeaa8cc8 (draft): bathroom stuff
   355   | o  10b8aeaa8cc8 (draft): bathroom stuff
   397   adding changesets
   401   adding changesets
   398   adding manifests
   402   adding manifests
   399   adding file changes
   403   adding file changes
   400   added 3 changesets with 3 changes to 1 files
   404   added 3 changesets with 3 changes to 1 files
   401 
   405 
   402 for simplicity shake we get the bathroom change in line again
   406 for simplicity sake we get the bathroom change in line again
   403 
   407 
   404   $ hg rebase -r 10b8aeaa8cc8 -d a224f2a4fb9f
   408   $ hg grab 10b8aeaa8cc8
   405   merging shopping
   409   merging shopping
   406   $ hg up tip
       
   407   ? files updated, 0 files merged, 0 files removed, 0 files unresolved (glob)
   410   ? files updated, 0 files merged, 0 files removed, 0 files unresolved (glob)
   408   $ hg phase --draft .
   411   $ hg phase --draft .
   409   $ hg log -G
   412   $ hg log -G
   410   @  75954b8cd933 (draft): bathroom stuff
   413   @  75954b8cd933 (draft): bathroom stuff
   411   |
   414   |
   423 
   426 
   424 
   427 
   425 Splitting change
   428 Splitting change
   426 ------------------
   429 ------------------
   427 
   430 
   428 histedit or uncommit
   431 This part is not written yet, but you can use either the `histedit` extension
       
   432 of the `uncommit` command to splitting a change.
       
   433 
       
   434   $ hg help uncommit
       
   435   hg uncommit [OPTION]... [NAME]
       
   436   
       
   437   move changes from parent revision to working directory
       
   438   
       
   439       Changes to selected files in parent revision appear again as uncommitted
       
   440       changed in the working directory. A new revision without selected changes
       
   441       is created, becomes the new parent and obsoletes the previous one.
       
   442   
       
   443       The --include option specify pattern to uncommit The --exclude option
       
   444       specify pattern to keep in the commit
       
   445   
       
   446       Return 0 if changed files are uncommitted.
       
   447   
       
   448   options:
       
   449   
       
   450    -a --all                 uncommit all changes when no arguments given
       
   451    -I --include PATTERN [+] include names matching the given patterns
       
   452    -X --exclude PATTERN [+] exclude names matching the given patterns
       
   453   
       
   454   [+] marked option can be specified multiple times
       
   455   
       
   456   use "hg -v help uncommit" to show the global options
       
   457 
       
   458 
       
   459 The edit command of histedit can be used to split changeset:
       
   460 
   429 
   461 
   430 Collapsing change
   462 Collapsing change
   431 ------------------
   463 ------------------
   432 
   464 
   433 This can be done with hg fold but the tutorial part is not written yet.
   465 The tutorial part is not written yet but can use `hg fold`:
   434 
   466 
   435 
   467   $ hg help fold
   436 
   468   hg fold rev
       
   469   
       
   470   Fold multiple revisions into a single one
       
   471   
       
   472       Revision from your current working directory to the specified one are fold
       
   473       as a new one replacing the other
       
   474   
       
   475       you can alternatively use --rev to explicitly specify revision to be fold
       
   476       ignoring the current working directory parent.
       
   477   
       
   478   options:
       
   479   
       
   480    -r --rev VALUE [+] explicitly specify the full set of revision to fold
       
   481   
       
   482   [+] marked option can be specified multiple times
       
   483   
       
   484   use "hg -v help fold" to show the global options
   437 
   485 
   438 
   486 
   439 -----------------------
   487 -----------------------
   440 Collaboration
   488 Collaboration
   441 -----------------------
   489 -----------------------
   442 
   490 
   443 
   491 
   444 sharing mutable changeset
   492 sharing mutable changesets
   445 ----------------------------
   493 ----------------------------
   446 
   494 
   447 To share mutable changeset with others, just check that the repo you interact
   495 To share mutable changesets with others, just check that the repo you interact
   448 with is "not publishing". Otherwise you will get the previously observe
   496 with is "not publishing". Otherwise you will get the previously observe
   449 behavior where exchanged changeset are automatically published.
   497 behavior where exchanged changeset are automatically published.
   450 
   498 
   451   $ cd ../remote
   499   $ cd ../remote
   452   $ hg -R ../local/ showconfig phases
   500   $ hg -R ../local/ showconfig phases
   476   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   524   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   477   
   525   
   478 
   526 
   479 
   527 
   480 
   528 
   481 We do not want to publish the "bathroom changeset". Let's rollback the last transaction
   529 We do not want to publish the "bathroom changeset". Let's rollback the last transaction.
       
   530 
       
   531 .. 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.
   482 
   532 
   483   $ hg rollback
   533   $ hg rollback
   484   repository tip rolled back to revision 4 (undo pull)
   534   repository tip rolled back to revision 4 (undo pull)
   485   $ hg log -G
   535   $ hg log -G
   486   o  a224f2a4fb9f (public): SPAM SPAM
   536   o  a224f2a4fb9f (public): SPAM SPAM
   565   
   615   
   566 
   616 
   567 
   617 
   568 When we pull from remote again we get an unstable state!
   618 When we pull from remote again we get an unstable state!
   569 
   619 
   570 
       
   571   $ hg pull remote
   620   $ hg pull remote
   572   pulling from $TESTTMP/remote
   621   pulling from $TESTTMP/remote
   573   searching for changes
   622   searching for changes
   574   adding changesets
   623   adding changesets
   575   adding manifests
   624   adding manifests
   617  
   666  
   618 
   667 
   619 
   668 
   620 
   669 
   621 To resolve this unstable state, you need to rebase bf1b0d202029 onto
   670 To resolve this unstable state, you need to rebase bf1b0d202029 onto
   622 a44c85f957d3. The "hg evolve" command will do this for you.
   671 a44c85f957d3. The `hg evolve` command will do this for you.
   623 
   672 
   624 It has a --dry-run option to only suggest the next move.
   673 It has a --dry-run option to only suggest the next move.
   625 
   674 
   626   $ hg evolve --dry-run
   675   $ hg evolve --dry-run
   627   move:[15] animals
   676   move:[15] animals
   772   |
   821   |
   773   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   822   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   774   
   823   
   775 
   824 
   776 
   825 
   777 Handling Conflicting amend
   826 Handling Divergent amend
   778 ----------------------------------------------
   827 ----------------------------------------------
   779 
   828 
   780 We can detect that multiple diverging/conflicting amendments have been made. There
   829 We can detect that multiple diverging/conflicting amendments have been made.
   781 will be a "evol-merge" command to merge conflicting amendments.
   830 The `evolve` command can solve this situation. But all corner case are not
       
   831 handled now.
   782 
   832 
   783 This section needs to be written.
   833 This section needs to be written.