Read about our upcoming Code of Conduct on this issue

Commit 99a429b0 authored by Taapas Agrawal's avatar Taapas Agrawal
Browse files

pick: added support for hg abort

This patch isolates abort logic for `hg pick --abort`
as `abortpick()`. For independent calls via `hg abort`
`hgabortpick()` is created and registered to the state
detection API.

Results are shown as tests.
parent 6f9e66433ff8
......@@ -6,6 +6,7 @@ Changelog
* prune: clarify error message when no revision were passed,
* evolve: avoid possible race conditions bu locking earlier
* abort: add support for `evolve` and `pick` to `hg abort` (hg-5.1+)
9.1.0 -- 2019-07-29
-------------------
......
......@@ -1364,7 +1364,8 @@ def setupevolveunfinished(ui):
continueflag=True, stopflag=True,
statushint=_msg,
abortfunc=evolvecmd.hgabortevolve)
statemod.addunfinished('pick', fname='pickstate', continueflag=True)
statemod.addunfinished('pick', fname='pickstate', continueflag=True,
abortfunc=cmdrewrite.hgabortpick)
else:
# compat <= hg-5.0 (5f2f6912c9e6)
estate = ('evolvestate', False, False, _('evolve in progress'),
......
......@@ -1535,3 +1535,9 @@ def abortpick(ui, repo, pickstate, abortcmd=False):
hg.updaterepo(repo, pctxnode, True)
pickstate.delete()
return 0
def hgabortpick(ui, repo):
"""logic to abort pick using 'hg abort'"""
with repo.wlock(), repo.lock():
pickstate = state.cmdstate(repo, path='pickstate')
return abortpick(ui, repo, pickstate, abortcmd=True)
#testcases abortcommand abortflag
Test for the pick command
$ cat >> $HGRCPATH <<EOF
......@@ -8,6 +9,13 @@ Test for the pick command
> EOF
$ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
#if abortflag
$ cat >> $HGRCPATH <<EOF
> [alias]
> abort = pick --abort
> EOF
#endif
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
......@@ -79,6 +87,11 @@ Aborting without interrupted pick
$ hg pick --abort
abort: no interrupted pick state exists
[255]
#if abortcommand
$ hg abort
abort: no operation in progress
[255]
#endif
Specifying both continue and revs
......@@ -235,7 +248,11 @@ Testing the abort functionality of hg pick
unresolved merge conflicts (see hg help resolve)
[1]
$ hg pick --abort
#if abortcommand
$ hg abort --dry-run
pick in progress, will be aborted
#endif
$ hg abort
aborting pick, updating to c437988de89f
$ hg glog
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment