changeset 5474:86c6c7951f74

evolve: fix content-div resolution when in parent-child form case: "two divergent csets where one is the parent of other" cset_b (content-divergent) | cset_a (content-divergent) | ~ Before this patch, we were not correctly handling the case when both the divergent cset are in parent-child form. And its resolution was going through the logic which solves other variants of content-divergence. Resolution (after this patch): merge is performed between the two and parent (or parent's successor, if apply) of lower one is treated as resolution parent.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sun, 26 Jul 2020 01:02:22 +0530
parents b8bcf7562ea1
children 21956b2a16eb
files hgext3rd/evolve/evolvecmd.py tests/test-evolve-issue5958.t
diffstat 2 files changed, 9 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Sun Jul 26 00:35:52 2020 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Jul 26 01:02:22 2020 +0530
@@ -390,6 +390,9 @@
     if otherp1 == divp1:
         # both are on the same parents
         pass
+    elif divergent == other.p1():
+        # both are in parent-child relation
+        pass
     elif succsotherp1 in gca and succsdivp1 in gca:
         # both are not on the same parent but have same parents's succs.
         if otheronly and divonly:
@@ -532,10 +535,6 @@
         evolvestate[b'temprevs'].append(divergent.node())
         evolvestate[b'divergent'] = divergent.node()
 
-    # Sometimes we already have the other cset where we want it
-    if relocatereq and other == divergent.p1():
-        relocatereq = False
-
     # relocate the other divergent if required
     if relocatereq:
         # relocating will help us understand during the time of conflicts that
--- a/tests/test-evolve-issue5958.t	Sun Jul 26 00:35:52 2020 +0530
+++ b/tests/test-evolve-issue5958.t	Sun Jul 26 01:02:22 2020 +0530
@@ -86,27 +86,18 @@
   x  cc71ffbc7c00 (1) add foo.txt
   
   $ hg evolve --content-divergent
-  merge:[6] add foo.txt
-  with: [4] add foo.txt
+  merge:[4] add foo.txt
+  with: [6] add foo.txt
   base: [1] add foo.txt
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  1 new orphan changesets
-  working directory is now at 5899f25049de
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 17e66b2fbf1b
 
   $ hg log -G
-  @  changeset:   7:5899f25049de
+  @  changeset:   7:17e66b2fbf1b
   |  tag:         tip
-  |  parent:      4:c17bf400a278
+  |  parent:      0:a24ed8ad918c
   |  user:        test
   |  date:        Wed Dec 31 23:59:58 1969 -0000
-  |  instability: orphan
-  |  summary:     add foo.txt
-  |
-  x  changeset:   4:c17bf400a278
-  |  parent:      0:a24ed8ad918c
-  |  user:        test
-  |  date:        Wed Dec 31 23:59:59 1969 -0000
-  |  obsolete:    rewritten using evolve as 7:5899f25049de
   |  summary:     add foo.txt
   |
   o  changeset:   0:a24ed8ad918c