changeset 5727:bc323205241b

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 22 Jan 2021 04:10:44 +0100
parents 1319abf8d8c4
children 6dbfd71cdcba
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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".")