evolve: introduce a resolutionparent variable and store it in evolvestate
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 14 Jun 2018 01:06:12 +0530
changeset 3848 90f1a64875ad
parent 3847 8bad32e1e6c1
child 3849 a17d4934c5ce
evolve: introduce a resolutionparent variable and store it in evolvestate This patch introduces a resolutionparent variable which will be the parent of final changeset after resolving content-divergent changesets. Till now, the parent is always the parent of one of the divergent node, but now in upcoming cases, it can be a successor of both the parents of divergent nodes.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Wed Jun 13 18:08:57 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Jun 14 01:06:12 2018 +0530
@@ -385,6 +385,10 @@
 
     otherp1 = other.p1().rev()
     divp1 = divergent.p1().rev()
+
+    # the changeset on which resolution changeset will be based on
+    resolutionparent = repo[divp1].node()
+
     gca = repo.revs("ancestor(%d, %d)" % (otherp1, divp1))
 
     # is relocation of one of the changeset required
@@ -412,6 +416,7 @@
     elif divp1 in gca and otherp1 not in gca:
         relocatereq = True
         divergent, other = other, divergent
+        resolutionparent = divergent.p1().node()
     else:
         msg = _("skipping %s: have a different parent than %s "
                 "(not handled yet)\n") % (divergent, other)
@@ -448,6 +453,7 @@
                  % divergent))
         return (False, '')
 
+    evolvestate['resolutionparent'] = resolutionparent
     # relocate the other divergent if required
     if relocatereq:
         # relocating will help us understand during the time of conflicts that
@@ -514,11 +520,12 @@
     assert tr is not None
     # whether to store the obsmarker in the evolvestate
     storemarker = False
+    resparent = evolvestate['resolutionparent']
     try:
         with repo.dirstate.parentchange():
-            repo.dirstate.setparents(divergent.p1().node(), node.nullid)
+            repo.dirstate.setparents(resparent, node.nullid)
 
-        dirstatedance(repo, divergent, divergent.p1(), None)
+        dirstatedance(repo, divergent, resparent, None)
 
         # merge the branches
         mergebranches(repo, divergent, other, base)