Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 42579:b8d54f4625cb
merge: disallow merge abort in case of an unfinished operation (issue6160)
This patch disallows `hg merge --abort` in case an operation of higher
precedence i.e unshelve, rebase, histedit are in unfinished states.
This is done so as to avoid partial abort of these operations in case
merge abort is called at an interrupted step.
The patch adds a `cmdutil.getunfinishedstate` function which checks
for operations under progress and returns a `statecheck` object for it.
Differential Revision: https://phab.mercurial-scm.org/D6607
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Tue, 09 Jul 2019 12:58:29 +0300 |
parents | f9da9d5f3f5a |
children | eb7bd7d64a9d |
comparison
equal
deleted
inserted
replaced
42578:9f73620a65fe | 42579:b8d54f4625cb |
---|---|
3950 opts = pycompat.byteskwargs(opts) | 3950 opts = pycompat.byteskwargs(opts) |
3951 abort = opts.get('abort') | 3951 abort = opts.get('abort') |
3952 if abort and repo.dirstate.p2() == nullid: | 3952 if abort and repo.dirstate.p2() == nullid: |
3953 cmdutil.wrongtooltocontinue(repo, _('merge')) | 3953 cmdutil.wrongtooltocontinue(repo, _('merge')) |
3954 if abort: | 3954 if abort: |
3955 state = cmdutil.getunfinishedstate(repo) | |
3956 if state and state._opname != 'merge': | |
3957 raise error.Abort(_('cannot abort merge with %s in progress') % | |
3958 (state._opname), hint=state.hint()) | |
3955 if node: | 3959 if node: |
3956 raise error.Abort(_("cannot specify a node with --abort")) | 3960 raise error.Abort(_("cannot specify a node with --abort")) |
3957 if opts.get('rev'): | 3961 if opts.get('rev'): |
3958 raise error.Abort(_("cannot specify both --rev and --abort")) | 3962 raise error.Abort(_("cannot specify both --rev and --abort")) |
3959 if opts.get('preview'): | 3963 if opts.get('preview'): |