# HG changeset patch # User Pierre-Yves David # Date 1611285044 -3600 # Node ID bc323205241bb90adff18dbe08b93344886f9bad # Parent 1319abf8d8c4d981204ede07eb89f3e0be56a787 divergence-resolution: pass the base changeset to _pickresolutionparent We will use the base soon, so lets take the easy part first. We also update the docstring to clarify the function intend. diff -r 1319abf8d8c4 -r bc323205241b hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Fri Jan 22 03:59:49 2021 +0100 +++ b/hgext3rd/evolve/evolvecmd.py Fri Jan 22 04:10:44 2021 +0100 @@ -284,9 +284,9 @@ repo.dirstate.setparents(newid, nodemod.nullid) return (True, replacementnode) -def _pickresolutionparent(ui, repo, divergent, other, evolvestate): - """ if relocation required, decide which divergent cset will be relocated - to the other side""" +def _pickresolutionparent(ui, repo, divergent, other, base, evolvestate): + """When the divergent changeset are not based on the same parent, we need + to find out where the divergence resolution will be based.""" # we don't handle merge content-divergent changesets yet if len(other.parents()) > 1: @@ -332,6 +332,12 @@ b"%s\n") % (divergent, other) ui.write_err(msg) return (False, b".") + try: + utility._singlesuccessor(repo, base.p1()) + except utility.MultipleSuccessorsError: + msg = (b"ambiguous orphan resolution parent for " + b"%s (base)\n") % base + ui.debug(msg) # the changeset on which resolution changeset will be based on resolutionparent = succsdivp1 @@ -473,8 +479,8 @@ evolvestate[b'old-divergent'] = None # setup everything before merging two content-divergent csets - picked, resolutionparent = _pickresolutionparent(ui, repo, divergent, - other, evolvestate) + picked, resolutionparent = _pickresolutionparent(ui, repo, divergent, other, + base, evolvestate) resolutionparent = repo[resolutionparent].node() if not picked: return (False, b".")