changeset 20642:0dc7a50345c2

merge: use the right ancestor when both sides copied the same file The tests shows no real changes because of this ... but there must be some weird corner cases where using the right ancestor for the merge planning is better than using the wrong one.
author Mads Kiilerich <madski@unity3d.com>
date Tue, 25 Feb 2014 20:29:46 +0100
parents 3db9e798e004
children 7fc371d2e5a3
files mercurial/merge.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Tue Feb 25 20:29:14 2014 +0100
+++ b/mercurial/merge.py	Tue Feb 25 20:29:46 2014 +0100
@@ -388,9 +388,14 @@
         if partial and not partial(f):
             continue
         if n1 and n2:
-            fla = ma.flags(f)
+            fa = f
+            a = ma.get(f, nullid)
+            if a == nullid:
+                fa = copy.get(f, f)
+                # Note: f as default is wrong - we can't really make a 3-way
+                # merge without an ancestor file.
+            fla = ma.flags(fa)
             nol = 'l' not in fl1 + fl2 + fla
-            a = ma.get(f, nullid)
             if n2 == a and fl2 == fla:
                 pass # remote unchanged - keep local
             elif n1 == a and fl1 == fla: # local unchanged - use remote