D5963: copies: handle a case when both merging csets are not descendant of merge base

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Mon Mar 11 11:45:01 EDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7694b685bb10: copies: handle a case when both merging csets are not descendant of merge base (authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5963?vs=14457&id=14460

REVISION DETAIL
  https://phab.mercurial-scm.org/D5963

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -554,8 +554,9 @@
       b
      +baba
   
-Test which demonstrate that fullcopytracing algorithm can fail to handle a case when both the csets are dirty
-----------------------------------------------------------------------------------------------------------
+Test to make sure that fullcopytracing algorithm don't fail when both the merging csets are dirty
+(a dirty cset is one who is not the descendant of merge base)
+-------------------------------------------------------------------------------------------------
 
   $ newrepo
   $ echo a > a
@@ -628,6 +629,5 @@
 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case
 both the merging csets will be dirty as no one is descendent of base revision:
 
-  $ hg graft -r 6 --base 4 --hidden 2>&1 | grep "AssertionError"
-  AssertionError
-
+  $ hg graft -r 6 --base 4 --hidden -t :other
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -608,7 +608,7 @@
     if dirtyc1:
         _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
                        incompletediverge)
-    else:
+    if dirtyc2:
         _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
                        incompletediverge)
 
@@ -647,7 +647,13 @@
     for f in bothnew:
         _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
         _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
-    if dirtyc1:
+    if dirtyc1 and dirtyc2:
+        remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
+                                   copy, bothdiverge, bothincompletediverge)
+        remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
+                                   copy, bothdiverge, bothincompletediverge)
+        remainder.update(remainder1)
+    elif dirtyc1:
         # incomplete copies may only be found on the "dirty" side for bothnew
         assert not both2['incomplete']
         remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,



To: khanchi97, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list