# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1521877625 -19800 # Node ID 2789c0ec2ad7e5db268d067e0c97a0b1bc139559 # Parent f23946bf6625f5bcc6fa108149e10238d5a0d003 evolve: move logic to complete interrupted relocation to new fn This moves logic which completed the interrupted relocation to it's own separate function as we will need that function in continuing phase-divergence and content-divergence too. diff -r f23946bf6625 -r 2789c0ec2ad7 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Sat Mar 24 12:58:12 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Sat Mar 24 13:17:05 2018 +0530 @@ -1262,6 +1262,28 @@ def _completeorphan(ui, repo, evolvestate): """function to complete the interrupted orphan resolution""" + node = _completerelocation(ui, repo, evolvestate) + # resolving conflicts can lead to empty wdir and node can be None in + # those cases + ctx = repo[evolvestate['current']] + newctx = repo[node] if node is not None else repo['.'] + compat.createmarkers(repo, [(ctx, (newctx,))], operation='evolve') + + # make sure we are continuing evolve and not `hg next --evolve` + if evolvestate['command'] == 'evolve': + evolvestate['replacements'][ctx.node()] = node + if evolvestate['orphanmerge']: + # processing a merge changeset with both parents obsoleted, + # stabilized on second parent, insert in front of list to + # re-process to stabilize on first parent + evolvestate['revs'].insert(0, repo[node].rev()) + evolvestate['orphanmerge'] = False + +def _completerelocation(ui, repo, evolvestate): + """function to complete the interrupted relocation of a commit + return the new node formed + """ + orig = repo[evolvestate['current']] ctx = orig source = ctx.extra().get('source') @@ -1313,18 +1335,4 @@ with repo.ui.configoverride(overrides, 'evolve-continue'): node = repo.commit(text=message, user=user, date=date, extra=extra) - - # resolving conflicts can lead to empty wdir and node can be None in - # those cases - newctx = repo[node] if node is not None else repo['.'] - compat.createmarkers(repo, [(ctx, (newctx,))], operation='evolve') - - # make sure we are continuing evolve and not `hg next --evolve` - if evolvestate['command'] == 'evolve': - evolvestate['replacements'][ctx.node()] = node - if evolvestate['orphanmerge']: - # processing a merge changeset with both parents obsoleted, - # stabilized on second parent, insert in front of list to - # re-process to stabilize on first parent - evolvestate['revs'].insert(0, repo[node].rev()) - evolvestate['orphanmerge'] = False + return node