Read about our upcoming Code of Conduct on this issue

Commit d421c848 authored by Taapas Agrawal's avatar Taapas Agrawal
Browse files

pick: factor our the abort function

This prepare the upcoming support for `hg pick` in `hg abort.
parent 2e14a9386316
......@@ -1491,15 +1491,7 @@ def cmdpick(ui, repo, *revs, **opts):
" (see hg help resolve)"))
elif abort:
if not pickstate:
raise error.Abort(_("no interrupted pick state exists"))
pickstate.load()
pctxnode = pickstate['oldpctx']
ui.status(_("aborting pick, updating to %s\n") %
node.hex(pctxnode)[:12])
hg.updaterepo(repo, pctxnode, True)
pickstate.delete()
return 0
return abortpick(ui, repo, pickstate)
else:
if revs:
......@@ -1531,3 +1523,15 @@ def cmdpick(ui, repo, *revs, **opts):
return 0
return 0
def abortpick(ui, repo, pickstate, abortcmd=False):
"""logic to abort pick"""
if not pickstate and not abortcmd:
raise error.Abort(_("no interrupted pick state exists"))
pickstate.load()
pctxnode = pickstate['oldpctx']
ui.status(_("aborting pick, updating to %s\n") %
node.hex(pctxnode)[:12])
hg.updaterepo(repo, pctxnode, True)
pickstate.delete()
return 0
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