changeset 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 85888efbdfff
children e7ed5d07cc4c
files mercurial/merge.py tests/test-rename-merge1.out tests/test-rename-merge2.out
diffstat 3 files changed, 12 insertions(+), 10 deletions(-) [+]
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
 
--- a/tests/test-rename-merge1.out	Fri Jan 11 23:36:56 2008 +0100
+++ b/tests/test-rename-merge1.out	Mon Jan 14 16:28:32 2008 -0600
@@ -11,9 +11,9 @@
    b
    b2
   all copies found (* = to merge, ! = divergent):
-   c2 -> a2 
+   c2 -> a2 !
    b -> a *
-   b2 -> a2 
+   b2 -> a2 !
   checking for directory renames
  a2: divergent renames -> dr
  a: remote moved to b -> m
--- a/tests/test-rename-merge2.out	Fri Jan 11 23:36:56 2008 +0100
+++ b/tests/test-rename-merge2.out	Mon Jan 14 16:28:32 2008 -0600
@@ -228,8 +228,8 @@
   unmatched files in other:
    c
   all copies found (* = to merge, ! = divergent):
-   c -> a 
-   b -> a 
+   c -> a !
+   b -> a !
   checking for directory renames
  a: divergent renames -> dr
  rev: versions differ -> m