diff mercurial/merge.py @ 5857:c704b03884ef

merge: add a bit more sanity to divergent copy checks
author Matt Mackall <mpm@selenic.com>
date Mon, 14 Jan 2008 16:28:32 -0600
parents f6bf89722e29
children 7855b88ba838
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Jan 11 23:36:56 2008 +0100
+++ b/mercurial/merge.py	Mon Jan 14 16:28:32 2008 -0600
@@ -210,21 +210,23 @@
     for f in u2:
         checkcopies(ctx(f, m2[f]), m1, ma)
 
-    d2 = {}
+    diverge2 = {}
     for of, fl in diverge.items():
-        for f in fl:
-            fo = list(fl)
-            fo.remove(f)
-            d2[f] = (of, fo)
+        if len(fl) == 1:
+            del diverge[of] # not actually divergent
+        else:
+            diverge2.update(dict.fromkeys(fl)) # reverse map for below
 
     if fullcopy:
         repo.ui.debug(_("  all copies found (* = to merge, ! = divergent):\n"))
         for f in fullcopy:
             note = ""
             if f in copy: note += "*"
-            if f in diverge: note += "!"
+            if f in diverge2: note += "!"
             repo.ui.debug(_("   %s -> %s %s\n") % (f, fullcopy[f], note))
 
+    del diverge2
+
     if not fullcopy or not repo.ui.configbool("merge", "followdirs", True):
         return copy, diverge