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