tests/test-graft-interrupted.t
changeset 44040 58db8f63f4e2
parent 43893 2e672ccc2220
child 44345 14d0e89520a2
equal deleted inserted replaced
44039:f652b7ddc1d4 44040:58db8f63f4e2
       
     1 #testcases abortcommand abortflag
       
     2 
       
     3 #if abortflag
       
     4   $ cat >> $HGRCPATH <<EOF
       
     5   > [alias]
       
     6   > abort = graft --abort
       
     7   > EOF
       
     8 #endif
       
     9 
       
    10 
       
    11 Testing the reading of old format graftstate file with newer mercurial
       
    12 
       
    13   $ hg init oldgraft
       
    14   $ cd oldgraft
       
    15   $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
       
    16   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
    17   @  2:8be98ac1a569 added c
       
    18   |
       
    19   o  1:80e6d2c47cfe added b
       
    20   |
       
    21   o  0:f7ad41964313 added a
       
    22   
       
    23   $ hg up 0
       
    24   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    25   $ echo bar > b
       
    26   $ hg add b
       
    27   $ hg ci -m "bar to b"
       
    28   created new head
       
    29   $ hg graft -r 1 -r 2
       
    30   grafting 1:80e6d2c47cfe "added b"
       
    31   merging b
       
    32   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
       
    33   abort: unresolved conflicts, can't continue
       
    34   (use 'hg resolve' and 'hg graft --continue')
       
    35   [255]
       
    36 
       
    37 Writing the nodes in old format to graftstate
       
    38 
       
    39   $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
       
    40   $ echo foo > b
       
    41   $ hg resolve -m
       
    42   (no more unresolved files)
       
    43   continue: hg graft --continue
       
    44   $ hg graft --continue
       
    45   grafting 1:80e6d2c47cfe "added b"
       
    46   grafting 2:8be98ac1a569 "added c"
       
    47 
       
    48 Testing that --user is preserved during conflicts and value is reused while
       
    49 running `hg graft --continue`
       
    50 
       
    51   $ hg log -G
       
    52   @  changeset:   5:711e9fa999f1
       
    53   |  tag:         tip
       
    54   |  user:        test
       
    55   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
    56   |  summary:     added c
       
    57   |
       
    58   o  changeset:   4:e5ad7353b408
       
    59   |  user:        test
       
    60   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
    61   |  summary:     added b
       
    62   |
       
    63   o  changeset:   3:9e887f7a939c
       
    64   |  parent:      0:f7ad41964313
       
    65   |  user:        test
       
    66   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
    67   |  summary:     bar to b
       
    68   |
       
    69   | o  changeset:   2:8be98ac1a569
       
    70   | |  user:        test
       
    71   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
    72   | |  summary:     added c
       
    73   | |
       
    74   | o  changeset:   1:80e6d2c47cfe
       
    75   |/   user:        test
       
    76   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
    77   |    summary:     added b
       
    78   |
       
    79   o  changeset:   0:f7ad41964313
       
    80      user:        test
       
    81      date:        Thu Jan 01 00:00:00 1970 +0000
       
    82      summary:     added a
       
    83   
       
    84 
       
    85   $ hg up '.^^'
       
    86   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    87 
       
    88   $ hg graft -r 1 -r 2 --user batman
       
    89   grafting 1:80e6d2c47cfe "added b"
       
    90   merging b
       
    91   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
       
    92   abort: unresolved conflicts, can't continue
       
    93   (use 'hg resolve' and 'hg graft --continue')
       
    94   [255]
       
    95 
       
    96   $ echo wat > b
       
    97   $ hg resolve -m
       
    98   (no more unresolved files)
       
    99   continue: hg graft --continue
       
   100 
       
   101   $ hg graft --continue
       
   102   grafting 1:80e6d2c47cfe "added b"
       
   103   grafting 2:8be98ac1a569 "added c"
       
   104 
       
   105   $ hg log -Gr 3::
       
   106   @  changeset:   7:11a36ffaacf2
       
   107   |  tag:         tip
       
   108   |  user:        batman
       
   109   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   110   |  summary:     added c
       
   111   |
       
   112   o  changeset:   6:76803afc6511
       
   113   |  parent:      3:9e887f7a939c
       
   114   |  user:        batman
       
   115   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   116   |  summary:     added b
       
   117   |
       
   118   | o  changeset:   5:711e9fa999f1
       
   119   | |  user:        test
       
   120   | |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   121   | |  summary:     added c
       
   122   | |
       
   123   | o  changeset:   4:e5ad7353b408
       
   124   |/   user:        test
       
   125   |    date:        Thu Jan 01 00:00:00 1970 +0000
       
   126   |    summary:     added b
       
   127   |
       
   128   o  changeset:   3:9e887f7a939c
       
   129   |  parent:      0:f7ad41964313
       
   130   ~  user:        test
       
   131      date:        Thu Jan 01 00:00:00 1970 +0000
       
   132      summary:     bar to b
       
   133   
       
   134 Test that --date is preserved and reused in `hg graft --continue`
       
   135 
       
   136   $ hg up '.^^'
       
   137   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   138   $ hg graft -r 1 -r 2 --date '1234560000 120'
       
   139   grafting 1:80e6d2c47cfe "added b"
       
   140   merging b
       
   141   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
       
   142   abort: unresolved conflicts, can't continue
       
   143   (use 'hg resolve' and 'hg graft --continue')
       
   144   [255]
       
   145 
       
   146   $ echo foobar > b
       
   147   $ hg resolve -m
       
   148   (no more unresolved files)
       
   149   continue: hg graft --continue
       
   150   $ hg graft --continue
       
   151   grafting 1:80e6d2c47cfe "added b"
       
   152   grafting 2:8be98ac1a569 "added c"
       
   153 
       
   154   $ hg log -Gr '.^^::.'
       
   155   @  changeset:   9:1896b76e007a
       
   156   |  tag:         tip
       
   157   |  user:        test
       
   158   |  date:        Fri Feb 13 21:18:00 2009 -0002
       
   159   |  summary:     added c
       
   160   |
       
   161   o  changeset:   8:ce2b4f1632af
       
   162   |  parent:      3:9e887f7a939c
       
   163   |  user:        test
       
   164   |  date:        Fri Feb 13 21:18:00 2009 -0002
       
   165   |  summary:     added b
       
   166   |
       
   167   o  changeset:   3:9e887f7a939c
       
   168   |  parent:      0:f7ad41964313
       
   169   ~  user:        test
       
   170      date:        Thu Jan 01 00:00:00 1970 +0000
       
   171      summary:     bar to b
       
   172   
       
   173 Test that --log is preserved and reused in `hg graft --continue`
       
   174 
       
   175   $ hg up '.^^'
       
   176   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   177   $ hg graft -r 1 -r 2 --log
       
   178   grafting 1:80e6d2c47cfe "added b"
       
   179   merging b
       
   180   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
       
   181   abort: unresolved conflicts, can't continue
       
   182   (use 'hg resolve' and 'hg graft --continue')
       
   183   [255]
       
   184 
       
   185   $ echo foobar > b
       
   186   $ hg resolve -m
       
   187   (no more unresolved files)
       
   188   continue: hg graft --continue
       
   189 
       
   190   $ hg graft --continue
       
   191   grafting 1:80e6d2c47cfe "added b"
       
   192   grafting 2:8be98ac1a569 "added c"
       
   193 
       
   194   $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.'
       
   195   @  11:30c1050a58b2 added c
       
   196   |  (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3)
       
   197   o  10:ec7eda2313e2 added b
       
   198   |  (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6)
       
   199   o  3:9e887f7a939c bar to b
       
   200   |
       
   201   ~
       
   202 
       
   203   $ cd ..
       
   204 
       
   205 Testing the --stop flag of `hg graft` which stops the interrupted graft
       
   206 
       
   207   $ hg init stopgraft
       
   208   $ cd stopgraft
       
   209   $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
       
   210 
       
   211   $ hg log -G
       
   212   @  changeset:   3:9150fe93bec6
       
   213   |  tag:         tip
       
   214   |  user:        test
       
   215   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   216   |  summary:     added d
       
   217   |
       
   218   o  changeset:   2:155349b645be
       
   219   |  user:        test
       
   220   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   221   |  summary:     added c
       
   222   |
       
   223   o  changeset:   1:5f6d8a4bf34a
       
   224   |  user:        test
       
   225   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   226   |  summary:     added b
       
   227   |
       
   228   o  changeset:   0:9092f1db7931
       
   229      user:        test
       
   230      date:        Thu Jan 01 00:00:00 1970 +0000
       
   231      summary:     added a
       
   232   
       
   233   $ hg up '.^^'
       
   234   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   235 
       
   236   $ echo foo > d
       
   237   $ hg ci -Aqm "added foo to d"
       
   238 
       
   239   $ hg graft --stop
       
   240   abort: no interrupted graft found
       
   241   [255]
       
   242 
       
   243   $ hg graft -r 3
       
   244   grafting 3:9150fe93bec6 "added d"
       
   245   merging d
       
   246   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
       
   247   abort: unresolved conflicts, can't continue
       
   248   (use 'hg resolve' and 'hg graft --continue')
       
   249   [255]
       
   250 
       
   251   $ hg graft --stop --continue
       
   252   abort: cannot use '--continue' and '--stop' together
       
   253   [255]
       
   254 
       
   255   $ hg graft --stop -U
       
   256   abort: cannot specify any other flag with '--stop'
       
   257   [255]
       
   258   $ hg graft --stop --rev 4
       
   259   abort: cannot specify any other flag with '--stop'
       
   260   [255]
       
   261   $ hg graft --stop --log
       
   262   abort: cannot specify any other flag with '--stop'
       
   263   [255]
       
   264 
       
   265   $ hg graft --stop
       
   266   stopped the interrupted graft
       
   267   working directory is now at a0deacecd59d
       
   268 
       
   269   $ hg diff
       
   270 
       
   271   $ hg log -Gr '.'
       
   272   @  changeset:   4:a0deacecd59d
       
   273   |  tag:         tip
       
   274   ~  parent:      1:5f6d8a4bf34a
       
   275      user:        test
       
   276      date:        Thu Jan 01 00:00:00 1970 +0000
       
   277      summary:     added foo to d
       
   278   
       
   279   $ hg graft -r 2 -r 3
       
   280   grafting 2:155349b645be "added c"
       
   281   grafting 3:9150fe93bec6 "added d"
       
   282   merging d
       
   283   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
       
   284   abort: unresolved conflicts, can't continue
       
   285   (use 'hg resolve' and 'hg graft --continue')
       
   286   [255]
       
   287 
       
   288   $ hg graft --stop
       
   289   stopped the interrupted graft
       
   290   working directory is now at 75b447541a9e
       
   291 
       
   292   $ hg diff
       
   293 
       
   294   $ hg log -G -T "{rev}:{node|short} {desc}"
       
   295   @  5:75b447541a9e added c
       
   296   |
       
   297   o  4:a0deacecd59d added foo to d
       
   298   |
       
   299   | o  3:9150fe93bec6 added d
       
   300   | |
       
   301   | o  2:155349b645be added c
       
   302   |/
       
   303   o  1:5f6d8a4bf34a added b
       
   304   |
       
   305   o  0:9092f1db7931 added a
       
   306   
       
   307   $ cd ..
       
   308 
       
   309 Testing the --abort flag for `hg graft` which aborts and rollback to state
       
   310 before the graft
       
   311 
       
   312   $ hg init abortgraft
       
   313   $ cd abortgraft
       
   314   $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
       
   315 
       
   316   $ hg up '.^^'
       
   317   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   318 
       
   319   $ echo x > x
       
   320   $ hg ci -Aqm "added x"
       
   321   $ hg up '.^'
       
   322   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   323   $ echo foo > c
       
   324   $ hg ci -Aqm "added foo to c"
       
   325 
       
   326   $ hg log -GT "{rev}:{node|short} {desc}"
       
   327   @  5:36b793615f78 added foo to c
       
   328   |
       
   329   | o  4:863a25e1a9ea added x
       
   330   |/
       
   331   | o  3:9150fe93bec6 added d
       
   332   | |
       
   333   | o  2:155349b645be added c
       
   334   |/
       
   335   o  1:5f6d8a4bf34a added b
       
   336   |
       
   337   o  0:9092f1db7931 added a
       
   338   
       
   339   $ hg up 9150fe93bec6
       
   340   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   341 
       
   342   $ hg abort
       
   343   abort: no interrupted graft to abort (abortflag !)
       
   344   abort: no operation in progress (abortcommand !)
       
   345   [255]
       
   346 
       
   347 when stripping is required
       
   348   $ hg graft -r 4 -r 5
       
   349   grafting 4:863a25e1a9ea "added x"
       
   350   grafting 5:36b793615f78 "added foo to c" (tip)
       
   351   merging c
       
   352   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
       
   353   abort: unresolved conflicts, can't continue
       
   354   (use 'hg resolve' and 'hg graft --continue')
       
   355   [255]
       
   356 
       
   357   $ hg graft --continue --abort
       
   358   abort: cannot use '--continue' and '--abort' together
       
   359   [255]
       
   360 
       
   361   $ hg graft --abort --stop
       
   362   abort: cannot use '--abort' and '--stop' together
       
   363   [255]
       
   364 
       
   365   $ hg graft --abort --currentuser
       
   366   abort: cannot specify any other flag with '--abort'
       
   367   [255]
       
   368 
       
   369   $ hg graft --abort --edit
       
   370   abort: cannot specify any other flag with '--abort'
       
   371   [255]
       
   372 
       
   373 #if abortcommand
       
   374 when in dry-run mode
       
   375   $ hg abort --dry-run
       
   376   graft in progress, will be aborted
       
   377 #endif
       
   378 
       
   379   $ hg abort
       
   380   graft aborted
       
   381   working directory is now at 9150fe93bec6
       
   382   $ hg log -GT "{rev}:{node|short} {desc}"
       
   383   o  5:36b793615f78 added foo to c
       
   384   |
       
   385   | o  4:863a25e1a9ea added x
       
   386   |/
       
   387   | @  3:9150fe93bec6 added d
       
   388   | |
       
   389   | o  2:155349b645be added c
       
   390   |/
       
   391   o  1:5f6d8a4bf34a added b
       
   392   |
       
   393   o  0:9092f1db7931 added a
       
   394   
       
   395 when stripping is not required
       
   396   $ hg graft -r 5
       
   397   grafting 5:36b793615f78 "added foo to c" (tip)
       
   398   merging c
       
   399   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
       
   400   abort: unresolved conflicts, can't continue
       
   401   (use 'hg resolve' and 'hg graft --continue')
       
   402   [255]
       
   403 
       
   404   $ hg abort
       
   405   graft aborted
       
   406   working directory is now at 9150fe93bec6
       
   407   $ hg log -GT "{rev}:{node|short} {desc}"
       
   408   o  5:36b793615f78 added foo to c
       
   409   |
       
   410   | o  4:863a25e1a9ea added x
       
   411   |/
       
   412   | @  3:9150fe93bec6 added d
       
   413   | |
       
   414   | o  2:155349b645be added c
       
   415   |/
       
   416   o  1:5f6d8a4bf34a added b
       
   417   |
       
   418   o  0:9092f1db7931 added a
       
   419   
       
   420 when some of the changesets became public
       
   421 
       
   422   $ hg graft -r 4 -r 5
       
   423   grafting 4:863a25e1a9ea "added x"
       
   424   grafting 5:36b793615f78 "added foo to c" (tip)
       
   425   merging c
       
   426   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
       
   427   abort: unresolved conflicts, can't continue
       
   428   (use 'hg resolve' and 'hg graft --continue')
       
   429   [255]
       
   430 
       
   431   $ hg log -GT "{rev}:{node|short} {desc}"
       
   432   @  6:6ec71c037d94 added x
       
   433   |
       
   434   | o  5:36b793615f78 added foo to c
       
   435   | |
       
   436   | | o  4:863a25e1a9ea added x
       
   437   | |/
       
   438   o |  3:9150fe93bec6 added d
       
   439   | |
       
   440   o |  2:155349b645be added c
       
   441   |/
       
   442   o  1:5f6d8a4bf34a added b
       
   443   |
       
   444   o  0:9092f1db7931 added a
       
   445   
       
   446   $ hg phase -r 6 --public
       
   447 
       
   448   $ hg abort
       
   449   cannot clean up public changesets 6ec71c037d94
       
   450   graft aborted
       
   451   working directory is now at 6ec71c037d94
       
   452 
       
   453 when we created new changesets on top of existing one
       
   454 
       
   455   $ hg up '.^^'
       
   456   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   457   $ echo y > y
       
   458   $ hg ci -Aqm "added y"
       
   459   $ echo z > z
       
   460   $ hg ci -Aqm "added z"
       
   461 
       
   462   $ hg up 3
       
   463   1 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
   464   $ hg log -GT "{rev}:{node|short} {desc}"
       
   465   o  8:637f9e9bbfd4 added z
       
   466   |
       
   467   o  7:123221671fd4 added y
       
   468   |
       
   469   | o  6:6ec71c037d94 added x
       
   470   | |
       
   471   | | o  5:36b793615f78 added foo to c
       
   472   | | |
       
   473   | | | o  4:863a25e1a9ea added x
       
   474   | | |/
       
   475   | @ |  3:9150fe93bec6 added d
       
   476   |/ /
       
   477   o /  2:155349b645be added c
       
   478   |/
       
   479   o  1:5f6d8a4bf34a added b
       
   480   |
       
   481   o  0:9092f1db7931 added a
       
   482   
       
   483   $ hg graft -r 8 -r 7 -r 5
       
   484   grafting 8:637f9e9bbfd4 "added z" (tip)
       
   485   grafting 7:123221671fd4 "added y"
       
   486   grafting 5:36b793615f78 "added foo to c"
       
   487   merging c
       
   488   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
       
   489   abort: unresolved conflicts, can't continue
       
   490   (use 'hg resolve' and 'hg graft --continue')
       
   491   [255]
       
   492 
       
   493   $ cd ..
       
   494   $ hg init pullrepo
       
   495   $ cd pullrepo
       
   496   $ cat >> .hg/hgrc <<EOF
       
   497   > [phases]
       
   498   > publish=False
       
   499   > EOF
       
   500   $ hg pull ../abortgraft --config phases.publish=False
       
   501   pulling from ../abortgraft
       
   502   requesting all changes
       
   503   adding changesets
       
   504   adding manifests
       
   505   adding file changes
       
   506   added 11 changesets with 9 changes to 8 files (+4 heads)
       
   507   new changesets 9092f1db7931:6b98ff0062dd (6 drafts)
       
   508   (run 'hg heads' to see heads, 'hg merge' to merge)
       
   509   $ hg up 9
       
   510   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   511   $ echo w > w
       
   512   $ hg ci -Aqm "added w" --config phases.publish=False
       
   513 
       
   514   $ cd ../abortgraft
       
   515   $ hg pull ../pullrepo
       
   516   pulling from ../pullrepo
       
   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   new changesets 311dfc6cf3bf (1 drafts)
       
   523   (run 'hg heads .' to see heads, 'hg merge' to merge)
       
   524 
       
   525   $ hg abort
       
   526   new changesets detected on destination branch, can't strip
       
   527   graft aborted
       
   528   working directory is now at 6b98ff0062dd
       
   529 
       
   530   $ cd ..
       
   531 
       
   532 ============================
       
   533 Testing --no-commit option:|
       
   534 ============================
       
   535 
       
   536   $ hg init nocommit
       
   537   $ cd nocommit
       
   538   $ echo a > a
       
   539   $ hg ci -qAma
       
   540   $ echo b > b
       
   541   $ hg ci -qAmb
       
   542   $ hg up -q 0
       
   543   $ echo c > c
       
   544   $ hg ci -qAmc
       
   545   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   546   @  2:d36c0562f908 c
       
   547   |
       
   548   | o  1:d2ae7f538514 b
       
   549   |/
       
   550   o  0:cb9a9f314b8b a
       
   551   
       
   552 
       
   553 Check reporting when --no-commit used with non-applicable options:
       
   554 
       
   555   $ hg graft 1 --no-commit -e
       
   556   abort: cannot specify --no-commit and --edit together
       
   557   [255]
       
   558 
       
   559   $ hg graft 1 --no-commit --log
       
   560   abort: cannot specify --no-commit and --log together
       
   561   [255]
       
   562 
       
   563   $ hg graft 1 --no-commit -D
       
   564   abort: cannot specify --no-commit and --currentdate together
       
   565   [255]
       
   566 
       
   567 Test --no-commit is working:
       
   568   $ hg graft 1 --no-commit
       
   569   grafting 1:d2ae7f538514 "b"
       
   570 
       
   571   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   572   @  2:d36c0562f908 c
       
   573   |
       
   574   | o  1:d2ae7f538514 b
       
   575   |/
       
   576   o  0:cb9a9f314b8b a
       
   577   
       
   578 
       
   579   $ hg diff
       
   580   diff -r d36c0562f908 b
       
   581   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   582   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
       
   583   @@ -0,0 +1,1 @@
       
   584   +b
       
   585 
       
   586 Prepare wrdir to check --no-commit is resepected after --continue:
       
   587 
       
   588   $ hg up -qC
       
   589   $ echo A>a
       
   590   $ hg ci -qm "A in file a"
       
   591   $ hg up -q 1
       
   592   $ echo B>a
       
   593   $ hg ci -qm "B in file a"
       
   594   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   595   @  4:2aa9ad1006ff B in file a
       
   596   |
       
   597   | o  3:09e253b87e17 A in file a
       
   598   | |
       
   599   | o  2:d36c0562f908 c
       
   600   | |
       
   601   o |  1:d2ae7f538514 b
       
   602   |/
       
   603   o  0:cb9a9f314b8b a
       
   604   
       
   605 
       
   606   $ hg graft 3 --no-commit
       
   607   grafting 3:09e253b87e17 "A in file a"
       
   608   merging a
       
   609   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
       
   610   abort: unresolved conflicts, can't continue
       
   611   (use 'hg resolve' and 'hg graft --continue')
       
   612   [255]
       
   613 
       
   614 Resolve conflict:
       
   615   $ echo A>a
       
   616   $ hg resolve --mark
       
   617   (no more unresolved files)
       
   618   continue: hg graft --continue
       
   619 
       
   620   $ hg graft --continue
       
   621   grafting 3:09e253b87e17 "A in file a"
       
   622   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   623   @  4:2aa9ad1006ff B in file a
       
   624   |
       
   625   | o  3:09e253b87e17 A in file a
       
   626   | |
       
   627   | o  2:d36c0562f908 c
       
   628   | |
       
   629   o |  1:d2ae7f538514 b
       
   630   |/
       
   631   o  0:cb9a9f314b8b a
       
   632   
       
   633   $ hg diff
       
   634   diff -r 2aa9ad1006ff a
       
   635   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   636   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   637   @@ -1,1 +1,1 @@
       
   638   -B
       
   639   +A
       
   640 
       
   641   $ hg up -qC
       
   642 
       
   643 Check --no-commit is resepected when passed with --continue:
       
   644 
       
   645   $ hg graft 3
       
   646   grafting 3:09e253b87e17 "A in file a"
       
   647   merging a
       
   648   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
       
   649   abort: unresolved conflicts, can't continue
       
   650   (use 'hg resolve' and 'hg graft --continue')
       
   651   [255]
       
   652 
       
   653 Resolve conflict:
       
   654   $ echo A>a
       
   655   $ hg resolve --mark
       
   656   (no more unresolved files)
       
   657   continue: hg graft --continue
       
   658 
       
   659   $ hg graft --continue --no-commit
       
   660   grafting 3:09e253b87e17 "A in file a"
       
   661   $ hg diff
       
   662   diff -r 2aa9ad1006ff a
       
   663   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   664   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   665   @@ -1,1 +1,1 @@
       
   666   -B
       
   667   +A
       
   668 
       
   669   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   670   @  4:2aa9ad1006ff B in file a
       
   671   |
       
   672   | o  3:09e253b87e17 A in file a
       
   673   | |
       
   674   | o  2:d36c0562f908 c
       
   675   | |
       
   676   o |  1:d2ae7f538514 b
       
   677   |/
       
   678   o  0:cb9a9f314b8b a
       
   679   
       
   680   $ hg up -qC
       
   681 
       
   682 Test --no-commit when graft multiple revisions:
       
   683 When there is conflict:
       
   684   $ hg graft -r "2::3" --no-commit
       
   685   grafting 2:d36c0562f908 "c"
       
   686   grafting 3:09e253b87e17 "A in file a"
       
   687   merging a
       
   688   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
       
   689   abort: unresolved conflicts, can't continue
       
   690   (use 'hg resolve' and 'hg graft --continue')
       
   691   [255]
       
   692 
       
   693   $ echo A>a
       
   694   $ hg resolve --mark
       
   695   (no more unresolved files)
       
   696   continue: hg graft --continue
       
   697   $ hg graft --continue
       
   698   grafting 3:09e253b87e17 "A in file a"
       
   699   $ hg diff
       
   700   diff -r 2aa9ad1006ff a
       
   701   --- a/a	Thu Jan 01 00:00:00 1970 +0000
       
   702   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
       
   703   @@ -1,1 +1,1 @@
       
   704   -B
       
   705   +A
       
   706   diff -r 2aa9ad1006ff c
       
   707   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   708   +++ b/c	Thu Jan 01 00:00:00 1970 +0000
       
   709   @@ -0,0 +1,1 @@
       
   710   +c
       
   711 
       
   712   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   713   @  4:2aa9ad1006ff B in file a
       
   714   |
       
   715   | o  3:09e253b87e17 A in file a
       
   716   | |
       
   717   | o  2:d36c0562f908 c
       
   718   | |
       
   719   o |  1:d2ae7f538514 b
       
   720   |/
       
   721   o  0:cb9a9f314b8b a
       
   722   
       
   723   $ hg up -qC
       
   724 
       
   725 When there is no conflict:
       
   726   $ echo d>d
       
   727   $ hg add d -q
       
   728   $ hg ci -qmd
       
   729   $ hg up 3 -q
       
   730   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   731   o  5:baefa8927fc0 d
       
   732   |
       
   733   o  4:2aa9ad1006ff B in file a
       
   734   |
       
   735   | @  3:09e253b87e17 A in file a
       
   736   | |
       
   737   | o  2:d36c0562f908 c
       
   738   | |
       
   739   o |  1:d2ae7f538514 b
       
   740   |/
       
   741   o  0:cb9a9f314b8b a
       
   742   
       
   743 
       
   744   $ hg graft -r 1 -r 5 --no-commit
       
   745   grafting 1:d2ae7f538514 "b"
       
   746   grafting 5:baefa8927fc0 "d" (tip)
       
   747   $ hg diff
       
   748   diff -r 09e253b87e17 b
       
   749   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   750   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
       
   751   @@ -0,0 +1,1 @@
       
   752   +b
       
   753   diff -r 09e253b87e17 d
       
   754   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   755   +++ b/d	Thu Jan 01 00:00:00 1970 +0000
       
   756   @@ -0,0 +1,1 @@
       
   757   +d
       
   758   $ hg log -GT "{rev}:{node|short} {desc}\n"
       
   759   o  5:baefa8927fc0 d
       
   760   |
       
   761   o  4:2aa9ad1006ff B in file a
       
   762   |
       
   763   | @  3:09e253b87e17 A in file a
       
   764   | |
       
   765   | o  2:d36c0562f908 c
       
   766   | |
       
   767   o |  1:d2ae7f538514 b
       
   768   |/
       
   769   o  0:cb9a9f314b8b a
       
   770   
       
   771   $ cd ..