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

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Sun Mar 3 06:50:49 UTC 2019


khanchi97 updated this revision to Diff 14310.

REPOSITORY
  rHG Mercurial

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

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
@@ -701,6 +701,29 @@
 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 c9241b0f2d5b --hidden 2>&1 | grep "AssertionError"
-  AssertionError
+  $ hg graft -r 6 --base c9241b0f2d5b --hidden
+  grafting 6:99802e4f1e46 "added willconflict and d" (tip)
+  merging willconflict
+  warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
+  abort: unresolved conflicts, can't continue
+  (use 'hg resolve' and 'hg graft --continue')
+  [255]
 
+  $ hg diff
+  diff -r 9a8bb7cc6814 willconflict
+  --- a/willconflict	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/willconflict	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,5 @@
+  +<<<<<<< local: 9a8bb7cc6814 - test: added c
+   foobar
+  +=======
+  +barfoo
+  +>>>>>>> graft: 99802e4f1e46 - test: added willconflict and d
+
+  $ echo barfoo > willconflict
+  $ hg res -m
+  (no more unresolved files)
+  continue: hg graft --continue
+
+  $ hg graft --continue
+  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
Cc: mercurial-devel


More information about the Mercurial-devel mailing list