changeset 5550:95d00d58885f

evolve: rely on resolutionparent when relocating divergent csets As discussed with Pierre-Yves the current behavior of resolving content-divergence when parent changes: 1) First we decide the resolution parent (the parent where resolution cset will be based on) 2) Relocate both the divergent csets to the resolution parent (if a cset is already on resolution parent, nothing to do for it) 3) Perform 3-way merge to create the resolution cset of content-div This patch makes sure that we rely on that decided resolution parent, when relocating divergent csets to the parent where the resolution cset will be based on.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 05 Aug 2020 15:04:48 +0530
parents 56e5dc7d6319
children 22c82f714fe1
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Tue Jul 21 11:23:41 2020 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Aug 05 15:04:48 2020 +0530
@@ -518,17 +518,12 @@
         ui.write((b'hg commit -m "`hg log -r %s --template={desc}`";\n'
                   % divergent))
         return (False, b".")
-    try:
-        succsdivp1 = utility._singlesuccessor(repo, divergent.p1())
-    except utility.MultipleSuccessorsError:
-        msg = _(b"ambiguous orphan resolution parent for %s")
-        raise error.Abort(msg % divergent.hex()[:12])
     # relocate divergent cset to its obsolete parent's successsor
-    if succsdivp1 != divergent.p1().rev():
+    if divergent.p1().node() != resolutionparent:
         evolvestate[b'relocating-div'] = True
         ui.status(_(b'rebasing "divergent" content-divergent changeset %s on'
-                    b' %s\n' % (divergent, repo[succsdivp1])))
-        newdivergent = _relocatedivergent(repo, divergent, repo[succsdivp1],
+                    b' %s\n' % (divergent, repo[resolutionparent])))
+        newdivergent = _relocatedivergent(repo, divergent, repo[resolutionparent],
                                           evolvestate)
         evolvestate[b'old-divergent'] = divergent.node()
         evolvestate[b'relocating-div'] = False
@@ -544,8 +539,8 @@
         # content divergent changesets
         evolvestate[b'relocating-other'] = True
         ui.status(_(b'rebasing "other" content-divergent changeset %s on'
-                    b' %s\n' % (other, divergent.p1())))
-        newother = _relocatedivergent(repo, other, divergent.p1(), evolvestate)
+                    b' %s\n' % (other, repo[resolutionparent])))
+        newother = _relocatedivergent(repo, other, repo[resolutionparent], evolvestate)
         evolvestate[b'old-other'] = other.node()
         evolvestate[b'relocating-other'] = False
         evolvestate[b'relocated-other'] = newother
@@ -1964,6 +1959,7 @@
         divergent = repo[evolvestate[b'divergent']]
         other = repo[evolvestate[b'other-divergent']]
         base = repo[evolvestate[b'base']]
+        resolutionparent = repo[evolvestate.get(b'resolutionparent')]
         if evolvestate[b'relocating-div']:
             newdiv = _completerelocation(ui, repo, evolvestate)
             current = repo[evolvestate[b'current']]
@@ -1980,8 +1976,8 @@
             if relocatereq:
                 evolvestate[b'relocating-other'] = True
                 ui.status(_(b'rebasing "other" content-divergent changeset %s on'
-                            b' %s\n' % (other, divergent.p1())))
-                newother = _relocatedivergent(repo, other, divergent.p1(),
+                            b' %s\n' % (other, resolutionparent)))
+                newother = _relocatedivergent(repo, other, resolutionparent,
                                               evolvestate)
                 evolvestate[b'old-other'] = other.node()
                 evolvestate[b'relocating-other'] = False