diff mercurial/merge.py @ 23476:39a12719ec65

merge: don't overwrite conflicting file in locally renamed directory When the local side has renamed a directory from a/ to b/ and added a file b/c in it, and the remote side has added a file a/c, we end up overwriting the local file b/c with the contents of remote file a/c. Add a check for this case and use the merge ('m') action in this case instead of the directory rename get ('dg') action.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 03 Dec 2014 11:02:52 -0800
parents 67f1d68861fb
children 406dfc63a1ad
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Dec 03 10:56:07 2014 -0800
+++ b/mercurial/merge.py	Wed Dec 03 11:02:52 2014 -0800
@@ -475,8 +475,12 @@
                 pass # we'll deal with it on m1 side
             elif f in movewithdir:
                 f2 = movewithdir[f]
-                actions['dg'].append((f2, (f, fl2),
-                                "local directory rename - get from " + f))
+                if f2 in m1:
+                    actions['m'].append((f2, (f2, f, None, False, pa.node()),
+                                   "local directory rename, both created"))
+                else:
+                    actions['dg'].append((f2, (f, fl2),
+                                    "local directory rename - get from " + f))
             elif f in copy:
                 f2 = copy[f]
                 if f2 in m2: