Mercurial > hg-stable
diff tests/test-graft.t @ 38292:2ec44160165d
graft: add a new `--stop` flag to stop interrupted graft
This patch adds a new flag `--stop` to `hg graft` command which stops the
interrupted graft.
The `--stop` flag takes back you to the last successful step i.e. it will keep
your grafted commits, it will just clear the mergestate and interrupted graft
state.
The `--stop` is different from `--abort` flag as the latter also undoes all the
work done till now which is sometimes not what the user wants.
Suppose you grafted a lot of changesets, you encountered conflicts, you resolved
them, did `hg graft --continue`, again encountered conflicts, continue, again
encountered conflicts. Now you are tired of solving merge conflicts and want to
resume this sometimes later. If you use the `--abort` functionality, it will
strip your already grafted changesets, making you loose the work you have done
resolving merge conflicts.
A general goal related to this flag is to add this flag to `rebase` and
`histedit` too. The evolve command already has this --stop flag.
Tests are added for the new flag.
.. feature::
`hg graft` now has a `--stop` flag to stop interrupted graft.
Differential Revision: https://phab.mercurial-scm.org/D3668
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 28 May 2018 21:13:32 +0530 |
parents | 2b8c8b8d1a06 |
children | 47f5454a30ed |
line wrap: on
line diff
--- a/tests/test-graft.t Tue Jun 12 02:36:34 2018 +0530 +++ b/tests/test-graft.t Mon May 28 21:13:32 2018 +0530 @@ -244,7 +244,7 @@ $ hg ci -m 'commit interrupted graft' abort: graft in progress - (use 'hg graft --continue' or 'hg update' to abort) + (use 'hg graft --continue' or 'hg graft --stop' to abort) [255] Abort the graft and try committing: @@ -1565,3 +1565,108 @@ o 3:9e887f7a939c bar to b | ~ + + $ cd .. + +Testing the --stop flag of `hg graft` which stops the interrupted graft + + $ hg init stopgraft + $ cd stopgraft + $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; + + $ hg log -G + @ changeset: 3:9150fe93bec6 + | tag: tip + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: added d + | + o changeset: 2:155349b645be + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: added c + | + o changeset: 1:5f6d8a4bf34a + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: added b + | + o changeset: 0:9092f1db7931 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: added a + + $ hg up '.^^' + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + + $ echo foo > d + $ hg ci -Aqm "added foo to d" + + $ hg graft --stop + abort: no interrupted graft found + [255] + + $ hg graft -r 3 + grafting 3:9150fe93bec6 "added d" + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + + $ hg graft --stop --continue + abort: cannot use '--continue' and '--stop' together + [255] + + $ hg graft --stop -U + abort: cannot specify any other flag with '--stop' + [255] + $ hg graft --stop --rev 4 + abort: cannot specify any other flag with '--stop' + [255] + $ hg graft --stop --log + abort: cannot specify any other flag with '--stop' + [255] + + $ hg graft --stop + stopped the interrupted graft + working directory is now at a0deacecd59d + + $ hg diff + + $ hg log -Gr '.' + @ changeset: 4:a0deacecd59d + | tag: tip + ~ parent: 1:5f6d8a4bf34a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: added foo to d + + $ hg graft -r 2 -r 3 + grafting 2:155349b645be "added c" + grafting 3:9150fe93bec6 "added d" + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + + $ hg graft --stop + stopped the interrupted graft + working directory is now at 75b447541a9e + + $ hg diff + + $ hg log -G -T "{rev}:{node|short} {desc}" + @ 5:75b447541a9e added c + | + o 4:a0deacecd59d added foo to d + | + | o 3:9150fe93bec6 added d + | | + | o 2:155349b645be added c + |/ + o 1:5f6d8a4bf34a added b + | + o 0:9092f1db7931 added a +