tests/test-uncommit-interactive.t
branchmercurial-4.2
changeset 3288 b714709afe6a
parent 3287 4303a46b4167
parent 3274 ddbb4d069203
child 3289 bd99cb54712b
child 3381 16b4f0e32d9d
equal deleted inserted replaced
3287:4303a46b4167 3288:b714709afe6a
     1 ================================================
       
     2 ||  The test for `hg uncommit --interactive`  ||
       
     3 ================================================
       
     4 
       
     5 Repo Setup
       
     6 ============
       
     7 
       
     8   $ . $TESTDIR/testlib/common.sh
       
     9   $ cat >> $HGRCPATH <<EOF
       
    10   > [ui]
       
    11   > interactive = true
       
    12   > [extensions]
       
    13   > evolve =
       
    14   > EOF
       
    15 
       
    16   $ glog() {
       
    17   >   hg log -G --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n' "$@"
       
    18   > }
       
    19 
       
    20   $ hg init repo
       
    21   $ cd repo
       
    22 
       
    23   $ touch a
       
    24   $ cat >> a << EOF
       
    25   > 1
       
    26   > 2
       
    27   > 3
       
    28   > 4
       
    29   > 5
       
    30   > EOF
       
    31 
       
    32   $ hg add a
       
    33   $ hg ci -m "The base commit"
       
    34 
       
    35 Make sure aborting the interactive selection does no magic
       
    36 ----------------------------------------------------------
       
    37 
       
    38   $ hg status
       
    39   $ hg uncommit -i<<EOF
       
    40   > q
       
    41   > EOF
       
    42   diff --git a/a b/a
       
    43   new file mode 100644
       
    44   examine changes to 'a'? [Ynesfdaq?] q
       
    45   
       
    46   abort: user quit
       
    47   [255]
       
    48   $ hg status
       
    49 
       
    50 Make a commit with multiple hunks
       
    51 ---------------------------------
       
    52 
       
    53   $ cat > a << EOF
       
    54   > -2
       
    55   > -1
       
    56   > 0
       
    57   > 1
       
    58   > 2
       
    59   > 3
       
    60   > foo
       
    61   > bar
       
    62   > 4
       
    63   > 5
       
    64   > babar
       
    65   > EOF
       
    66 
       
    67   $ hg diff
       
    68   diff -r 7733902a8d94 a
       
    69   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
    70   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
    71   @@ -1,5 +1,11 @@
       
    72   +-2
       
    73   +-1
       
    74   +0
       
    75    1
       
    76    2
       
    77    3
       
    78   +foo
       
    79   +bar
       
    80    4
       
    81    5
       
    82   +babar
       
    83 
       
    84   $ hg ci -m "another one"
       
    85 
       
    86 Not selecting anything to uncommit
       
    87 ==================================
       
    88 
       
    89   $ hg uncommit -i<<EOF
       
    90   > y
       
    91   > n
       
    92   > n
       
    93   > n
       
    94   > EOF
       
    95   diff --git a/a b/a
       
    96   3 hunks, 6 lines changed
       
    97   examine changes to 'a'? [Ynesfdaq?] y
       
    98   
       
    99   @@ -1,3 +1,6 @@
       
   100   +-2
       
   101   +-1
       
   102   +0
       
   103    1
       
   104    2
       
   105    3
       
   106   discard change 1/3 to 'a'? [Ynesfdaq?] n
       
   107   
       
   108   @@ -1,5 +4,7 @@
       
   109    1
       
   110    2
       
   111    3
       
   112   +foo
       
   113   +bar
       
   114    4
       
   115    5
       
   116   discard change 2/3 to 'a'? [Ynesfdaq?] n
       
   117   
       
   118   @@ -4,2 +9,3 @@
       
   119    4
       
   120    5
       
   121   +babar
       
   122   discard change 3/3 to 'a'? [Ynesfdaq?] n
       
   123   
       
   124   abort: nothing selected to uncommit
       
   125   [255]
       
   126   $ hg status
       
   127 
       
   128 Uncommit a chunk
       
   129 ================
       
   130 
       
   131   $ hg amend --extract -n "note on amend --extract" -i<<EOF
       
   132   > y
       
   133   > y
       
   134   > n
       
   135   > n
       
   136   > EOF
       
   137   current hg version does not support storing note in obsmarker
       
   138   current hg version does not support storing note in obsmarker
       
   139   diff --git a/a b/a
       
   140   3 hunks, 6 lines changed
       
   141   examine changes to 'a'? [Ynesfdaq?] y
       
   142   
       
   143   @@ -1,3 +1,6 @@
       
   144   +-2
       
   145   +-1
       
   146   +0
       
   147    1
       
   148    2
       
   149    3
       
   150   discard change 1/3 to 'a'? [Ynesfdaq?] y
       
   151   
       
   152   @@ -1,5 +4,7 @@
       
   153    1
       
   154    2
       
   155    3
       
   156   +foo
       
   157   +bar
       
   158    4
       
   159    5
       
   160   discard change 2/3 to 'a'? [Ynesfdaq?] n
       
   161   
       
   162   @@ -4,2 +9,3 @@
       
   163    4
       
   164    5
       
   165   +babar
       
   166   discard change 3/3 to 'a'? [Ynesfdaq?] n
       
   167   
       
   168 
       
   169   $ hg obslog
       
   170   @  678a59e5ff90 (3) another one
       
   171   |
       
   172   x  f70fb463d5bf (1) another one
       
   173        rewritten(content) as 678a59e5ff90 by test (Thu Jan 01 00:00:00 1970 +0000)
       
   174          note: note on amend --extract
       
   175   
       
   176 The unselected part should be in the diff
       
   177 -----------------------------------------
       
   178 
       
   179   $ hg diff
       
   180   diff -r 678a59e5ff90 a
       
   181   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   182   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   183   @@ -1,3 +1,6 @@
       
   184   +-2
       
   185   +-1
       
   186   +0
       
   187    1
       
   188    2
       
   189    3
       
   190 
       
   191 The commit should contain the rest of part
       
   192 ------------------------------------------
       
   193 
       
   194   $ hg exp
       
   195   # HG changeset patch
       
   196   # User test
       
   197   # Date 0 0
       
   198   #      Thu Jan 01 00:00:00 1970 +0000
       
   199   # Node ID 678a59e5ff90754d5e94719bd82ad169be773c21
       
   200   # Parent  7733902a8d94c789ca81d866bea1893d79442db6
       
   201   another one
       
   202   
       
   203   diff -r 7733902a8d94 -r 678a59e5ff90 a
       
   204   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   205   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   206   @@ -1,5 +1,8 @@
       
   207    1
       
   208    2
       
   209    3
       
   210   +foo
       
   211   +bar
       
   212    4
       
   213    5
       
   214   +babar
       
   215 
       
   216 Uncommiting on dirty working directory
       
   217 ======================================
       
   218 
       
   219   $ hg status
       
   220   M a
       
   221   $ hg diff
       
   222   diff -r 678a59e5ff90 a
       
   223   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   224   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   225   @@ -1,3 +1,6 @@
       
   226   +-2
       
   227   +-1
       
   228   +0
       
   229    1
       
   230    2
       
   231    3
       
   232 
       
   233   $ hg uncommit -n "testing uncommit on dirty wdir" -i<<EOF
       
   234   > y
       
   235   > n
       
   236   > y
       
   237   > EOF
       
   238   current hg version does not support storing note in obsmarker
       
   239   diff --git a/a b/a
       
   240   2 hunks, 3 lines changed
       
   241   examine changes to 'a'? [Ynesfdaq?] y
       
   242   
       
   243   @@ -1,5 +1,7 @@
       
   244    1
       
   245    2
       
   246    3
       
   247   +foo
       
   248   +bar
       
   249    4
       
   250    5
       
   251   discard change 1/2 to 'a'? [Ynesfdaq?] n
       
   252   
       
   253   @@ -4,2 +6,3 @@
       
   254    4
       
   255    5
       
   256   +babar
       
   257   discard change 2/2 to 'a'? [Ynesfdaq?] y
       
   258   
       
   259   patching file a
       
   260   Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
       
   261 
       
   262   $ hg diff
       
   263   diff -r 46e35360be47 a
       
   264   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   265   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   266   @@ -1,3 +1,6 @@
       
   267   +-2
       
   268   +-1
       
   269   +0
       
   270    1
       
   271    2
       
   272    3
       
   273   @@ -5,3 +8,4 @@
       
   274    bar
       
   275    4
       
   276    5
       
   277   +babar
       
   278 
       
   279   $ hg exp
       
   280   # HG changeset patch
       
   281   # User test
       
   282   # Date 0 0
       
   283   #      Thu Jan 01 00:00:00 1970 +0000
       
   284   # Node ID 46e35360be473bf761bedf3d05de4a68ffd9d9f8
       
   285   # Parent  7733902a8d94c789ca81d866bea1893d79442db6
       
   286   another one
       
   287   
       
   288   diff -r 7733902a8d94 -r 46e35360be47 a
       
   289   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   290   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   291   @@ -1,5 +1,7 @@
       
   292    1
       
   293    2
       
   294    3
       
   295   +foo
       
   296   +bar
       
   297    4
       
   298    5
       
   299 
       
   300 Checking the obsolescence history
       
   301 
       
   302   $ hg obslog
       
   303   @  46e35360be47 (5) another one
       
   304   |
       
   305   x  678a59e5ff90 (3) another one
       
   306   |    rewritten(content) as 46e35360be47 by test (Thu Jan 01 00:00:00 1970 +0000)
       
   307   |      note: testing uncommit on dirty wdir
       
   308   |
       
   309   x  f70fb463d5bf (1) another one
       
   310        rewritten(content) as 678a59e5ff90 by test (Thu Jan 01 00:00:00 1970 +0000)
       
   311          note: note on amend --extract
       
   312   
       
   313 
       
   314 Push the changes back to the commit and more commits for more testing
       
   315 
       
   316   $ hg amend
       
   317   $ glog
       
   318   @  7:905eb2a23ea2@default(draft) another one
       
   319   |
       
   320   o  0:7733902a8d94@default(draft) The base commit
       
   321   
       
   322   $ touch foo
       
   323   $ echo "hey" >> foo
       
   324   $ hg ci -Am "Added foo"
       
   325   adding foo
       
   326 
       
   327 Testing uncommiting a whole changeset and also for a file addition
       
   328 ==================================================================
       
   329 
       
   330   $ hg uncommit -i<<EOF
       
   331   > y
       
   332   > y
       
   333   > EOF
       
   334   diff --git a/foo b/foo
       
   335   new file mode 100644
       
   336   examine changes to 'foo'? [Ynesfdaq?] y
       
   337   
       
   338   @@ -0,0 +1,1 @@
       
   339   +hey
       
   340   discard this change to 'foo'? [Ynesfdaq?] y
       
   341   
       
   342   new changeset is empty
       
   343   (use 'hg prune .' to remove it)
       
   344 
       
   345   $ hg status
       
   346   A foo
       
   347   $ hg diff
       
   348   diff -r 857367499298 foo
       
   349   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   350   +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
       
   351   @@ -0,0 +1,1 @@
       
   352   +hey
       
   353 
       
   354   $ hg exp
       
   355   # HG changeset patch
       
   356   # User test
       
   357   # Date 0 0
       
   358   #      Thu Jan 01 00:00:00 1970 +0000
       
   359   # Node ID 857367499298e999b5841bb01df65f73088b5d3b
       
   360   # Parent  905eb2a23ea2d92073419d0e19165b90d36ea223
       
   361   Added foo
       
   362   
       
   363   $ hg amend
       
   364 
       
   365 Testing to uncommit removed files completely
       
   366 ============================================
       
   367 
       
   368   $ hg rm a
       
   369   $ hg ci -m "Removed a"
       
   370   $ hg exp
       
   371   # HG changeset patch
       
   372   # User test
       
   373   # Date 0 0
       
   374   #      Thu Jan 01 00:00:00 1970 +0000
       
   375   # Node ID 219cfe20964e93f8bb9bd82ceaa54d3b776046db
       
   376   # Parent  42cc15efbec26c14d96d805dee2766ba91d1fd31
       
   377   Removed a
       
   378   
       
   379   diff -r 42cc15efbec2 -r 219cfe20964e a
       
   380   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   381   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   382   @@ -1,11 +0,0 @@
       
   383   --2
       
   384   --1
       
   385   -0
       
   386   -1
       
   387   -2
       
   388   -3
       
   389   -foo
       
   390   -bar
       
   391   -4
       
   392   -5
       
   393   -babar
       
   394 
       
   395 Not examining the file
       
   396 ----------------------
       
   397 
       
   398   $ hg uncommit -i<<EOF
       
   399   > n
       
   400   > EOF
       
   401   diff --git a/a b/a
       
   402   deleted file mode 100644
       
   403   examine changes to 'a'? [Ynesfdaq?] n
       
   404   
       
   405   abort: nothing selected to uncommit
       
   406   [255]
       
   407 
       
   408 Examining the file
       
   409 ------------------
       
   410 XXX: there is a bug in interactive selection as it is not letting to examine the
       
   411 file. Tried with curses too. In the curses UI, if you just unselect the hunks
       
   412 and the not file mod thing at the top, it will show the same "nothing unselected
       
   413 to uncommit" message which is a bug in interactive selection.
       
   414 
       
   415   $ hg uncommit -i<<EOF
       
   416   > y
       
   417   > EOF
       
   418   diff --git a/a b/a
       
   419   deleted file mode 100644
       
   420   examine changes to 'a'? [Ynesfdaq?] y
       
   421   
       
   422   new changeset is empty
       
   423   (use 'hg prune .' to remove it)
       
   424 
       
   425   $ hg diff
       
   426   diff -r 737487f1e5f8 a
       
   427   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   428   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   429   @@ -1,11 +0,0 @@
       
   430   --2
       
   431   --1
       
   432   -0
       
   433   -1
       
   434   -2
       
   435   -3
       
   436   -foo
       
   437   -bar
       
   438   -4
       
   439   -5
       
   440   -babar
       
   441   $ hg status
       
   442   R a
       
   443   $ hg exp
       
   444   # HG changeset patch
       
   445   # User test
       
   446   # Date 0 0
       
   447   #      Thu Jan 01 00:00:00 1970 +0000
       
   448   # Node ID 737487f1e5f853e55decb73ea31522c63e7f5980
       
   449   # Parent  42cc15efbec26c14d96d805dee2766ba91d1fd31
       
   450   Removed a
       
   451   
       
   452 
       
   453   $ hg prune .
       
   454   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   455   working directory now at 42cc15efbec2
       
   456   1 changesets pruned
       
   457   $ hg revert --all
       
   458   undeleting a
       
   459 
       
   460   $ glog
       
   461   @  12:42cc15efbec2@default(draft) Added foo
       
   462   |
       
   463   o  7:905eb2a23ea2@default(draft) another one
       
   464   |
       
   465   o  0:7733902a8d94@default(draft) The base commit
       
   466   
       
   467 
       
   468 Testing when a new file is added in the last commit
       
   469 ===================================================
       
   470 
       
   471   $ echo "foo" >> foo
       
   472   $ touch x
       
   473   $ echo "abcd" >> x
       
   474   $ hg add x
       
   475   $ hg ci -m "Added x"
       
   476   $ hg uncommit -i<<EOF
       
   477   > y
       
   478   > y
       
   479   > y
       
   480   > n
       
   481   > EOF
       
   482   diff --git a/foo b/foo
       
   483   1 hunks, 1 lines changed
       
   484   examine changes to 'foo'? [Ynesfdaq?] y
       
   485   
       
   486   @@ -1,1 +1,2 @@
       
   487    hey
       
   488   +foo
       
   489   discard change 1/2 to 'foo'? [Ynesfdaq?] y
       
   490   
       
   491   diff --git a/x b/x
       
   492   new file mode 100644
       
   493   examine changes to 'x'? [Ynesfdaq?] y
       
   494   
       
   495   @@ -0,0 +1,1 @@
       
   496   +abcd
       
   497   discard change 2/2 to 'x'? [Ynesfdaq?] n
       
   498   
       
   499 
       
   500   $ hg exp
       
   501   # HG changeset patch
       
   502   # User test
       
   503   # Date 0 0
       
   504   #      Thu Jan 01 00:00:00 1970 +0000
       
   505   # Node ID 25a080d13cb23dbd014839f54d99a96e57ba7e9b
       
   506   # Parent  42cc15efbec26c14d96d805dee2766ba91d1fd31
       
   507   Added x
       
   508   
       
   509   diff -r 42cc15efbec2 -r 25a080d13cb2 x
       
   510   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   511   +++ b/x	Thu Jan 01 00:00:00 1970 +0000
       
   512   @@ -0,0 +1,1 @@
       
   513   +abcd
       
   514 
       
   515   $ hg diff
       
   516   diff -r 25a080d13cb2 foo
       
   517   --- a/foo	Thu Jan 01 00:00:00 1970 +0000
       
   518   +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
       
   519   @@ -1,1 +1,2 @@
       
   520    hey
       
   521   +foo
       
   522 
       
   523   $ hg status
       
   524   M foo
       
   525 
       
   526   $ hg revert --all
       
   527   reverting foo
       
   528 
       
   529 Testing between the stack and with dirty working copy
       
   530 =====================================================
       
   531 
       
   532   $ glog
       
   533   @  18:25a080d13cb2@default(draft) Added x
       
   534   |
       
   535   o  12:42cc15efbec2@default(draft) Added foo
       
   536   |
       
   537   o  7:905eb2a23ea2@default(draft) another one
       
   538   |
       
   539   o  0:7733902a8d94@default(draft) The base commit
       
   540   
       
   541   $ hg up 905eb2a23ea2
       
   542   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   543 
       
   544   $ touch bar
       
   545   $ echo "foo" >> bar
       
   546   $ hg add bar
       
   547   $ hg status
       
   548   A bar
       
   549   ? foo.orig
       
   550 
       
   551   $ hg exp
       
   552   # HG changeset patch
       
   553   # User test
       
   554   # Date 0 0
       
   555   #      Thu Jan 01 00:00:00 1970 +0000
       
   556   # Node ID 905eb2a23ea2d92073419d0e19165b90d36ea223
       
   557   # Parent  7733902a8d94c789ca81d866bea1893d79442db6
       
   558   another one
       
   559   
       
   560   diff -r 7733902a8d94 -r 905eb2a23ea2 a
       
   561   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   562   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   563   @@ -1,5 +1,11 @@
       
   564   +-2
       
   565   +-1
       
   566   +0
       
   567    1
       
   568    2
       
   569    3
       
   570   +foo
       
   571   +bar
       
   572    4
       
   573    5
       
   574   +babar
       
   575 
       
   576   $ hg uncommit -i<<EOF
       
   577   > y
       
   578   > n
       
   579   > n
       
   580   > y
       
   581   > EOF
       
   582   diff --git a/a b/a
       
   583   3 hunks, 6 lines changed
       
   584   examine changes to 'a'? [Ynesfdaq?] y
       
   585   
       
   586   @@ -1,3 +1,6 @@
       
   587   +-2
       
   588   +-1
       
   589   +0
       
   590    1
       
   591    2
       
   592    3
       
   593   discard change 1/3 to 'a'? [Ynesfdaq?] n
       
   594   
       
   595   @@ -1,5 +4,7 @@
       
   596    1
       
   597    2
       
   598    3
       
   599   +foo
       
   600   +bar
       
   601    4
       
   602    5
       
   603   discard change 2/3 to 'a'? [Ynesfdaq?] n
       
   604   
       
   605   @@ -4,2 +9,3 @@
       
   606    4
       
   607    5
       
   608   +babar
       
   609   discard change 3/3 to 'a'? [Ynesfdaq?] y
       
   610   
       
   611   patching file a
       
   612   Hunk #1 succeeded at 1 with fuzz 1 (offset -1 lines).
       
   613   2 new unstable changesets
       
   614 
       
   615   $ hg diff
       
   616   diff -r 676366511f95 a
       
   617   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   618   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   619   @@ -8,3 +8,4 @@
       
   620    bar
       
   621    4
       
   622    5
       
   623   +babar
       
   624   diff -r 676366511f95 bar
       
   625   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   626   +++ b/bar	Thu Jan 01 00:00:00 1970 +0000
       
   627   @@ -0,0 +1,1 @@
       
   628   +foo
       
   629 
       
   630   $ hg exp
       
   631   # HG changeset patch
       
   632   # User test
       
   633   # Date 0 0
       
   634   #      Thu Jan 01 00:00:00 1970 +0000
       
   635   # Node ID 676366511f95ca4122413dcf79b45eaab61fb387
       
   636   # Parent  7733902a8d94c789ca81d866bea1893d79442db6
       
   637   another one
       
   638   
       
   639   diff -r 7733902a8d94 -r 676366511f95 a
       
   640   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   641   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   642   @@ -1,5 +1,10 @@
       
   643   +-2
       
   644   +-1
       
   645   +0
       
   646    1
       
   647    2
       
   648    3
       
   649   +foo
       
   650   +bar
       
   651    4
       
   652    5
       
   653   $ hg status
       
   654   M a
       
   655   A bar
       
   656   ? foo.orig
       
   657 
       
   658 More uncommit on the same dirty working copy
       
   659 =============================================
       
   660 
       
   661   $ hg uncommit -i<<EOF
       
   662   > y
       
   663   > y
       
   664   > n
       
   665   > EOF
       
   666   diff --git a/a b/a
       
   667   2 hunks, 5 lines changed
       
   668   examine changes to 'a'? [Ynesfdaq?] y
       
   669   
       
   670   @@ -1,3 +1,6 @@
       
   671   +-2
       
   672   +-1
       
   673   +0
       
   674    1
       
   675    2
       
   676    3
       
   677   discard change 1/2 to 'a'? [Ynesfdaq?] y
       
   678   
       
   679   @@ -1,5 +4,7 @@
       
   680    1
       
   681    2
       
   682    3
       
   683   +foo
       
   684   +bar
       
   685    4
       
   686    5
       
   687   discard change 2/2 to 'a'? [Ynesfdaq?] n
       
   688   
       
   689 
       
   690   $ hg exp
       
   691   # HG changeset patch
       
   692   # User test
       
   693   # Date 0 0
       
   694   #      Thu Jan 01 00:00:00 1970 +0000
       
   695   # Node ID 62d907d0c4fa13b4b8bfeed05f13751035daf963
       
   696   # Parent  7733902a8d94c789ca81d866bea1893d79442db6
       
   697   another one
       
   698   
       
   699   diff -r 7733902a8d94 -r 62d907d0c4fa a
       
   700   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   701   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   702   @@ -1,5 +1,7 @@
       
   703    1
       
   704    2
       
   705    3
       
   706   +foo
       
   707   +bar
       
   708    4
       
   709    5
       
   710 
       
   711   $ hg diff
       
   712   diff -r 62d907d0c4fa a
       
   713   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   714   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   715   @@ -1,3 +1,6 @@
       
   716   +-2
       
   717   +-1
       
   718   +0
       
   719    1
       
   720    2
       
   721    3
       
   722   @@ -5,3 +8,4 @@
       
   723    bar
       
   724    4
       
   725    5
       
   726   +babar
       
   727   diff -r 62d907d0c4fa bar
       
   728   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   729   +++ b/bar	Thu Jan 01 00:00:00 1970 +0000
       
   730   @@ -0,0 +1,1 @@
       
   731   +foo
       
   732 
       
   733   $ hg status
       
   734   M a
       
   735   A bar
       
   736   ? foo.orig
       
   737 
       
   738 Interactive uncommit with a pattern
       
   739 -----------------------------------
       
   740 
       
   741 (more setup)
       
   742 
       
   743   $ hg ci -m 'roaming changes'
       
   744   $ cat > b << EOF
       
   745   > a
       
   746   > b
       
   747   > c
       
   748   > d
       
   749   > e
       
   750   > f
       
   751   > h
       
   752   > EOF
       
   753   $ hg add b
       
   754   $ hg ci -m 'add b'
       
   755   $ echo 'celeste' >> a
       
   756   $ echo 'i' >> b
       
   757   $ hg ci -m 'some more changes'
       
   758   $ hg export
       
   759   # HG changeset patch
       
   760   # User test
       
   761   # Date 0 0
       
   762   #      Thu Jan 01 00:00:00 1970 +0000
       
   763   # Node ID be5c67225e80b050867862bbd9f4755c4e9207c5
       
   764   # Parent  c280a907fddcef2ffe9fadcc2d87f29998e22b2f
       
   765   some more changes
       
   766   
       
   767   diff -r c280a907fddc -r be5c67225e80 a
       
   768   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   769   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   770   @@ -9,3 +9,4 @@
       
   771    4
       
   772    5
       
   773    babar
       
   774   +celeste
       
   775   diff -r c280a907fddc -r be5c67225e80 b
       
   776   --- a/b	Thu Jan 01 00:00:00 1970 +0000
       
   777   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
       
   778   @@ -5,3 +5,4 @@
       
   779    e
       
   780    f
       
   781    h
       
   782   +i
       
   783 
       
   784   $ hg uncommit -i a << DONE
       
   785   > y
       
   786   > y
       
   787   > DONE
       
   788   diff --git a/a b/a
       
   789   1 hunks, 1 lines changed
       
   790   examine changes to 'a'? [Ynesfdaq?] y
       
   791   
       
   792   @@ -9,3 +9,4 @@
       
   793    4
       
   794    5
       
   795    babar
       
   796   +celeste
       
   797   discard this change to 'a'? [Ynesfdaq?] y
       
   798   
       
   799   $ hg status
       
   800   M a
       
   801   ? foo.orig
       
   802   $ hg diff
       
   803   diff -r c701d7c8d18b a
       
   804   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   805   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   806   @@ -9,3 +9,4 @@
       
   807    4
       
   808    5
       
   809    babar
       
   810   +celeste
       
   811   $ hg export
       
   812   # HG changeset patch
       
   813   # User test
       
   814   # Date 0 0
       
   815   #      Thu Jan 01 00:00:00 1970 +0000
       
   816   # Node ID c701d7c8d18be55a92688f4458c26bd74fb1f525
       
   817   # Parent  c280a907fddcef2ffe9fadcc2d87f29998e22b2f
       
   818   some more changes
       
   819   
       
   820   diff -r c280a907fddc -r c701d7c8d18b b
       
   821   --- a/b	Thu Jan 01 00:00:00 1970 +0000
       
   822   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
       
   823   @@ -5,3 +5,4 @@
       
   824    e
       
   825    f
       
   826    h
       
   827   +i
       
   828 
       
   829 (reset)
       
   830 
       
   831   $ cat << EOF  > a
       
   832   > -3
       
   833   > -2
       
   834   > -1
       
   835   > 0
       
   836   > 1
       
   837   > 2
       
   838   > 3
       
   839   > foo
       
   840   > bar
       
   841   > 4
       
   842   > 5
       
   843   > babar
       
   844   > celeste
       
   845   > EOF
       
   846   $ hg amend 
       
   847 
       
   848 Same but do not select some change in 'a'
       
   849 
       
   850   $ hg uncommit -i a << DONE
       
   851   > y
       
   852   > y
       
   853   > n
       
   854   > DONE
       
   855   diff --git a/a b/a
       
   856   2 hunks, 2 lines changed
       
   857   examine changes to 'a'? [Ynesfdaq?] y
       
   858   
       
   859   @@ -1,3 +1,4 @@
       
   860   +-3
       
   861    -2
       
   862    -1
       
   863    0
       
   864   discard change 1/2 to 'a'? [Ynesfdaq?] y
       
   865   
       
   866   @@ -9,3 +10,4 @@
       
   867    4
       
   868    5
       
   869    babar
       
   870   +celeste
       
   871   discard change 2/2 to 'a'? [Ynesfdaq?] n
       
   872   
       
   873   $ hg status
       
   874   M a
       
   875   ? foo.orig
       
   876 
       
   877   $ hg diff
       
   878   diff -r 28d5de12b225 a
       
   879   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   880   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   881   @@ -1,3 +1,4 @@
       
   882   +-3
       
   883    -2
       
   884    -1
       
   885    0
       
   886 
       
   887   $ hg export
       
   888   # HG changeset patch
       
   889   # User test
       
   890   # Date 0 0
       
   891   #      Thu Jan 01 00:00:00 1970 +0000
       
   892   # Node ID 28d5de12b225d1e0951110cced8d8994227be026
       
   893   # Parent  c280a907fddcef2ffe9fadcc2d87f29998e22b2f
       
   894   some more changes
       
   895   
       
   896   diff -r c280a907fddc -r 28d5de12b225 a
       
   897   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   898   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   899   @@ -9,3 +9,4 @@
       
   900    4
       
   901    5
       
   902    babar
       
   903   +celeste
       
   904   diff -r c280a907fddc -r 28d5de12b225 b
       
   905   --- a/b	Thu Jan 01 00:00:00 1970 +0000
       
   906   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
       
   907   @@ -5,3 +5,4 @@
       
   908    e
       
   909    f
       
   910    h
       
   911   +i
       
   912 
       
   913   $ cat b
       
   914   a
       
   915   b
       
   916   c
       
   917   d
       
   918   e
       
   919   f
       
   920   h
       
   921   i