changeset 5782:72f65a647203

divergence-resolution: take parent successors in account If the parent were rewritten we need to take them in accound, but to help with resolution of a stack and to have a better 3 way merge. Changes in test file reflect the new behavior.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Fri, 22 Jan 2021 05:37:43 +0100
parents 613a144de642
children c5c879fed91c
files hgext3rd/evolve/evolvecmd.py tests/test-evolve-content-divergent-case-A5.t
diffstat 2 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Thu Jan 28 13:40:36 2021 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Jan 22 05:37:43 2021 +0100
@@ -318,7 +318,7 @@
 
     otherp1 = succsotherp1 = other.p1().rev()
     divp1 = succsdivp1 = divergent.p1().rev()
-    basep1 = base.p1().rev()
+    succsbasep1 = base.p1().rev()
 
     # finding single successors of divp1 and otherp1
     try:
@@ -336,7 +336,7 @@
         ui.write_err(msg)
         return (False, b".")
     try:
-        utility._singlesuccessor(repo, base.p1())
+        succsbasep1 = utility._singlesuccessor(repo, base.p1())
     except utility.MultipleSuccessorsError:
         msg = (b"ambiguous orphan resolution parent for "
                b"%s (base)\n") % base
@@ -376,9 +376,9 @@
     elif divergent == other.p1():
         # both are in parent-child relation
         pass
-    elif basep1 in (divp1, otherp1):
+    elif succsbasep1 in (succsdivp1, succsotherp1):
         # only one side moved, set parent of moved one as resolution parent
-        if basep1 == divp1:
+        if succsbasep1 == succsdivp1:
             resolutionparent = succsotherp1
         else:
             pass
--- a/tests/test-evolve-content-divergent-case-A5.t	Thu Jan 28 13:40:36 2021 +0530
+++ b/tests/test-evolve-content-divergent-case-A5.t	Fri Jan 22 05:37:43 2021 +0100
@@ -46,7 +46,6 @@
 ..      O ●
 ..
 .. (Resolution):
-XXX: current resolution is wrong and doesn't not do what we expect here, it will be fixed in next patch
 ..
 ..   B'○  ○ C'''
 ..     | /
@@ -124,15 +123,15 @@
   merge:[4] C
   with: [6] C
   base: [3] C
-  rebasing "divergent" content-divergent changeset b80b2bbeb664 on 7db72af2e30d
+  rebasing "other" content-divergent changeset f085ae420789 on f5bc6836db60
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 43fe36f524e4
+  working directory is now at 88b737dc9dd8
 
   $ hg log -G
-  @  8:43fe36f524e4 (draft): C
+  @  8:88b737dc9dd8 (draft): C
   |
-  o  5:7db72af2e30d (draft): B
-  |
+  | o  5:7db72af2e30d (draft): B
+  |/
   o  1:f5bc6836db60 (draft): A
   |
   o  0:a9bdc8b26820 (public): O
@@ -168,15 +167,15 @@
   merge:[5] C
   with: [6] C
   base: [3] C
-  rebasing "other" content-divergent changeset b80b2bbeb664 on 7db72af2e30d
+  rebasing "divergent" content-divergent changeset f085ae420789 on f5bc6836db60
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory is now at 5844b6472deb
+  working directory is now at fa4ff8bb3531
 
   $ hg log -G
-  @  8:5844b6472deb (draft): C
+  @  8:fa4ff8bb3531 (draft): C
   |
-  o  4:7db72af2e30d (draft): B
-  |
+  | o  4:7db72af2e30d (draft): B
+  |/
   o  1:f5bc6836db60 (draft): A
   |
   o  0:a9bdc8b26820 (public): O