This is an archive of the discontinued Mercurial Phabricator instance.

graft: add a new `--stop` flag to stop interrupted graft
ClosedPublic

Authored by pulkit on May 29 2018, 4:43 PM.

Details

Summary

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

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.May 29 2018, 4:43 PM
yuja added a subscriber: yuja.Jun 5 2018, 8:07 AM
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.

No idea if git is right regarding UI, but they appear to have --quit for
this.

https://git-scm.com/docs/git-cherry-pick

The code looks good to me. We'll need to update cmdutil.unfinishedstates
as well.

In D3668#58070, @yuja wrote:
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.

No idea if git is right regarding UI, but they appear to have --quit for
this.
https://git-scm.com/docs/git-cherry-pick

I asked people on IRC, nbjoerg and one more said '--stop' is better. However I am fine with changing that to --quit

The code looks good to me. We'll need to update cmdutil.unfinishedstates
as well.

Will do. I was also thinking to add a new general help topic which will document about --continue, --abort and --stop flags and point them as help text or "help text of help text" there.

pulkit updated this revision to Diff 9013.Jun 11 2018, 4:56 PM
yuja added a comment.Jun 12 2018, 8:18 AM
In https://phab.mercurial-scm.org/D3668#58070, @yuja wrote:
> >   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.
>
> No idea if git is right regarding UI, but they appear to have `--quit` for
>  this.
>
> https://git-scm.com/docs/git-cherry-pick
I asked people on IRC, nbjoerg and one more said '--stop' is better. However I am fine with changing that to `--quit`

Good. Since I don't have any preference either, let's just stick to --stop.

Replaced some --abort in error message and queued, thanks.

This revision was automatically updated to reflect the committed changes.