[Request] [+- ] D8653: copies: handle more cases where a file got replaced by a copy
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Jun 23 17:04:17 UTC 2020
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This patch fixes the changeset-centric version in a pretty
straight-forward way. It fixes it to automatically resolve the
conflict, which is better than resulting in a modify/delete conflict
as it was before b4057d001760 <https://phab.mercurial-scm.org/rHGb4057d0017601357a59a18f2996719302ae51765> (merge: when rename was made on both
sides, use ancestor as merge base, 2020-01-22).
I'll leave it for later to test and explicitly handle cases where
files have been renamed to the same target on different sides of the
merge.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D8653
AFFECTED FILES
mercurial/merge.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
@@ -501,11 +501,11 @@
original
#else
$ hg merge 2
- 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ merging x and y to y
+ 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
-BROKEN: should be "modified"
$ cat y
- original
+ modified
#endif
Same as above, but in the opposite direction
#if filelog
@@ -523,11 +523,11 @@
#else
$ hg co -qC 2
$ hg merge 3
- 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ merging y and x to y
+ 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
-BROKEN: should be "modified"
$ cat y
- original
+ modified
#endif
Test for a case in fullcopytracing algorithm where neither of the merging csets
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -639,6 +639,20 @@
(f, f, None, False, pa.node()),
b'both created',
)
+ elif f in branch_copies1.copy:
+ fa = branch_copies1.copy[f]
+ actions[f] = (
+ mergestatemod.ACTION_MERGE,
+ (f, fa, fa, False, pa.node()),
+ b'local replaced from %s' % fa,
+ )
+ elif f in branch_copies2.copy:
+ fa = branch_copies2.copy[f]
+ actions[f] = (
+ mergestatemod.ACTION_MERGE,
+ (fa, f, fa, False, pa.node()),
+ b'other replaced from %s' % fa,
+ )
else:
a = ma[f]
fla = ma.flags(f)
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200623/792f6ca0/attachment-0001.html>
More information about the Mercurial-patches
mailing list