diff mercurial/merge.py @ 16794:98687cdddcb1

merge: warn about file deleted in one branch and renamed in other (issue3074) For divergent renames the following message is printed during merge: note: possible conflict - file was renamed multiple times to: newfile file2 When a file is renamed in one branch and deleted in the other, the file still exists after a merge. With this change a similar message is printed for mv+rm: note: possible conflict - file was deleted and renamed to: newfile
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 23 May 2012 20:50:16 +0200
parents e7bf09acd410
children ce7bc04d863b
line wrap: on
line diff
--- a/mercurial/merge.py	Wed May 23 17:33:19 2012 +0200
+++ b/mercurial/merge.py	Wed May 23 20:50:16 2012 +0200
@@ -198,9 +198,11 @@
     elif pa == p2: # backwards
         pa = p1.p1()
     elif pa and repo.ui.configbool("merge", "followcopies", True):
-        copy, diverge = copies.mergecopies(repo, p1, p2, pa)
+        copy, diverge, renamedelete = copies.mergecopies(repo, p1, p2, pa)
         for of, fl in diverge.iteritems():
             act("divergent renames", "dr", of, fl)
+        for of, fl in renamedelete.iteritems():
+            act("rename and delete", "rd", of, fl)
 
     repo.ui.note(_("resolving manifests\n"))
     repo.ui.debug(" overwrite: %s, partial: %s\n"
@@ -409,6 +411,12 @@
                            "multiple times to:\n") % f)
             for nf in fl:
                 repo.ui.warn(" %s\n" % nf)
+        elif m == "rd": # rename and delete
+            fl = a[2]
+            repo.ui.warn(_("note: possible conflict - %s was deleted "
+                           "and renamed to:\n") % f)
+            for nf in fl:
+                repo.ui.warn(" %s\n" % nf)
         elif m == "e": # exec
             flags = a[2]
             repo.wopener.audit(f)