Mercurial > evolve
changeset 6199:09754e40d2db
pick: factor _dopick() out of cmdpick()
author | Luke Granger-Brown <hg@lukegb.com> |
---|---|
date | Tue, 15 Mar 2022 19:28:17 +0300 |
parents | cc80747ef3c8 |
children | ceab1399302c |
files | hgext3rd/evolve/cmdrewrite.py |
diffstat | 1 files changed, 23 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Mon Mar 14 18:00:00 2022 +0000 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 15 19:28:17 2022 +0300 @@ -1403,28 +1403,32 @@ pickstate.save() raise error.InterventionRequired(_(b"unresolved merge conflicts" b" (see hg help resolve)")) - overrides = {(b'phases', b'new-commit'): origctx.phase()} - with repo.ui.configoverride(overrides, b'pick'): - newnode = repo.commit(text=origctx.description(), - user=origctx.user(), - date=origctx.date(), extra=origctx.extra()) - repo.dirstate.setbranch(origctx.branch()) + return _dopick(ui, repo, pickstate, origctx) + +def _dopick(ui, repo, pickstate, origctx): + """shared logic for performing or continuing a pick""" + overrides = {(b'phases', b'new-commit'): origctx.phase()} + with repo.ui.configoverride(overrides, b'pick'): + newnode = repo.commit(text=origctx.description(), + user=origctx.user(), + date=origctx.date(), extra=origctx.extra()) + repo.dirstate.setbranch(origctx.branch()) - if pickstate: - pickstate.delete() - if newnode is None: - replacements = {(origctx.node(),): []} - else: - newctx = repo[newnode] - replacements = {(origctx.node(),): [newctx.node()]} - compat.cleanupnodes(repo, replacements, operation=b"pick") + if pickstate: + pickstate.delete() + if newnode is None: + replacements = {(origctx.node(),): []} + else: + newctx = repo[newnode] + replacements = {(origctx.node(),): [newctx.node()]} + compat.cleanupnodes(repo, replacements, operation=b"pick") - if newnode is None: - ui.warn(_(b"note: picking %d:%s created no changes to commit\n") % - (origctx.rev(), origctx)) - return 0 + if newnode is None: + ui.warn(_(b"note: picking %d:%s created no changes to commit\n") % + (origctx.rev(), origctx)) + return 0 - return 0 + return 0 def abortpick(ui, repo, pickstate, abortcmd=False): """logic to abort pick"""