merge: add debug diagnostics for findcopies
authorMatt Mackall <mpm@selenic.com>
Thu, 04 Oct 2007 19:44:37 -0500
changeset 5371 17ed9b9a0d03
parent 5368 61462e7d62ed
child 5372 6f6aa7f3bc1c
merge: add debug diagnostics for findcopies
mercurial/merge.py
tests/test-copy-move-merge.out
tests/test-double-merge.out
tests/test-issue522.out
tests/test-issue672.out
tests/test-merge-commit.out
tests/test-merge7.out
tests/test-rename-dir-merge.out
tests/test-rename-merge1.out
tests/test-up-local-change.out
--- a/mercurial/merge.py	Wed Oct 03 17:17:28 2007 -0500
+++ b/mercurial/merge.py	Thu Oct 04 19:44:37 2007 -0500
@@ -188,9 +188,18 @@
     if not m1 or not m2 or not ma:
         return {}, {}
 
+    repo.ui.debug(_("  searching for copies back to rev %d\n") % limit)
+
     u1 = nonoverlap(m1, m2, ma)
     u2 = nonoverlap(m2, m1, ma)
 
+    if u1:
+        repo.ui.debug(_("  unmatched files in local:\n   %s\n")
+                      % "\n   ".join(u1))
+    if u2:
+        repo.ui.debug(_("  unmatched files in other:\n   %s\n")
+                      % "\n   ".join(u2))
+
     for f in u1:
         checkcopies(ctx(f, m1[f]), m2, ma)
 
@@ -204,9 +213,19 @@
             fo.remove(f)
             d2[f] = (of, fo)
 
+    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 += "!"
+            repo.ui.debug(_("   %s -> %s %s\n") % (f, fullcopy[f], note))
+
     if not fullcopy or not repo.ui.configbool("merge", "followdirs", True):
         return copy, diverge
 
+    repo.ui.debug(_("  checking for directory renames\n"))
+
     # generate a directory move map
     d1, d2 = dirs(m1), dirs(m2)
     invalid = {}
@@ -241,6 +260,9 @@
     if not dirmove:
         return copy, diverge
 
+    for d in dirmove:
+        repo.ui.debug(_("  dir %s -> %s\n") % (d, dirmove[d]))
+
     # check unaccounted nonoverlapping files against directory moves
     for f in u1 + u2:
         if f not in fullcopy:
@@ -248,6 +270,7 @@
                 if f.startswith(d):
                     # new file added in a directory that was moved, move it
                     copy[f] = dirmove[d] + f[len(d):]
+                    repo.ui.debug(_("  file %s -> %s\n") % (f, copy[f]))
                     break
 
     return copy, diverge
--- a/tests/test-copy-move-merge.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-copy-move-merge.out	Thu Oct 04 19:44:37 2007 -0500
@@ -2,6 +2,14 @@
 resolving manifests
  overwrite None partial False
  ancestor 583c7b748052 local fb3948d97f07+ remote 40da226db0f0
+  searching for copies back to rev 1
+  unmatched files in other:
+   b
+   c
+  all copies found (* = to merge, ! = divergent):
+   c -> a *
+   b -> a *
+  checking for directory renames
  a: remote moved to c -> m
  a: remote moved to b -> m
 copying a to b
--- a/tests/test-double-merge.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-double-merge.out	Thu Oct 04 19:44:37 2007 -0500
@@ -1,6 +1,12 @@
 resolving manifests
  overwrite None partial False
  ancestor 310fd17130da local 2092631ce82b+ remote 7731dad1c2b9
+  searching for copies back to rev 1
+  unmatched files in other:
+   bar
+  all copies found (* = to merge, ! = divergent):
+   bar -> foo *
+  checking for directory renames
  foo: versions differ -> m
  foo: remote copied to bar -> m
 copying foo to bar
--- a/tests/test-issue522.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-issue522.out	Thu Oct 04 19:44:37 2007 -0500
@@ -4,6 +4,9 @@
 resolving manifests
  overwrite None partial False
  ancestor bbd179dfa0a7 local 71766447bdbb+ remote 4d9e78aaceee
+  searching for copies back to rev 1
+  unmatched files in local:
+   bar
  foo: remote is newer -> g
 getting foo
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-issue672.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-issue672.out	Thu Oct 04 19:44:37 2007 -0500
@@ -4,6 +4,12 @@
 resolving manifests
  overwrite None partial False
  ancestor 81f4b099af3d local c64f439569a9+ remote 2f8037f47a5c
+  searching for copies back to rev 1
+  unmatched files in other:
+   1a
+  all copies found (* = to merge, ! = divergent):
+   1a -> 1 
+  checking for directory renames
  1: other deleted -> r
  1a: remote created -> g
 removing 1
@@ -15,6 +21,12 @@
 resolving manifests
  overwrite None partial False
  ancestor c64f439569a9 local ac7575e3c052+ remote 746e9549ea96
+  searching for copies back to rev 1
+  unmatched files in local:
+   1a
+  all copies found (* = to merge, ! = divergent):
+   1a -> 1 *
+  checking for directory renames
  1a: local moved to 1 -> m
 merging 1a and 1
 my 1a@ac7575e3c052+ other 1@746e9549ea96 ancestor 1@81f4b099af3d
@@ -24,6 +36,12 @@
 resolving manifests
  overwrite None partial False
  ancestor c64f439569a9 local 746e9549ea96+ remote ac7575e3c052
+  searching for copies back to rev 1
+  unmatched files in other:
+   1a
+  all copies found (* = to merge, ! = divergent):
+   1a -> 1 *
+  checking for directory renames
  1: remote moved to 1a -> m
 copying 1 to 1a
 merging 1 and 1a
--- a/tests/test-merge-commit.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-merge-commit.out	Thu Oct 04 19:44:37 2007 -0500
@@ -23,6 +23,7 @@
 resolving manifests
  overwrite None partial False
  ancestor 0a3ab4856510 local 2d2f9a22c82b+ remote 7d3b554bfdf1
+  searching for copies back to rev 1
  bar: versions differ -> m
 merging bar
 my bar@2d2f9a22c82b+ other bar@7d3b554bfdf1 ancestor bar@0a3ab4856510
@@ -68,6 +69,7 @@
 resolving manifests
  overwrite None partial False
  ancestor 0a3ab4856510 local 2d2f9a22c82b+ remote 96ab80c60897
+  searching for copies back to rev 1
  bar: versions differ -> m
 merging bar
 my bar@2d2f9a22c82b+ other bar@96ab80c60897 ancestor bar@0a3ab4856510
--- a/tests/test-merge7.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-merge7.out	Thu Oct 04 19:44:37 2007 -0500
@@ -24,6 +24,7 @@
 resolving manifests
  overwrite None partial False
  ancestor faaea63e63a9 local 451c744aabcc+ remote a070d41e8360
+  searching for copies back to rev 1
  test.txt: versions differ -> m
 merging test.txt
 my test.txt@451c744aabcc+ other test.txt@a070d41e8360 ancestor test.txt@faaea63e63a9
--- a/tests/test-rename-dir-merge.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-rename-dir-merge.out	Thu Oct 04 19:44:37 2007 -0500
@@ -9,6 +9,18 @@
 resolving manifests
  overwrite None partial False
  ancestor f9b20c0d4c51 local ce36d17b18fb+ remote 55119e611c80
+  searching for copies back to rev 1
+  unmatched files in local:
+   a/c
+  unmatched files in other:
+   b/a
+   b/b
+  all copies found (* = to merge, ! = divergent):
+   b/a -> a/a 
+   b/b -> a/b 
+  checking for directory renames
+  dir a/ -> b/
+  file a/c -> b/c
  a/c: remote renamed directory to b/c -> d
  a/b: other deleted -> r
  a/a: other deleted -> r
@@ -34,6 +46,18 @@
 resolving manifests
  overwrite None partial False
  ancestor f9b20c0d4c51 local 55119e611c80+ remote ce36d17b18fb
+  searching for copies back to rev 1
+  unmatched files in local:
+   b/a
+   b/b
+  unmatched files in other:
+   a/c
+  all copies found (* = to merge, ! = divergent):
+   b/a -> a/a 
+   b/b -> a/b 
+  checking for directory renames
+  dir a/ -> b/
+  file a/c -> b/c
  None: local renamed directory to b/c -> d
 getting a/c to b/c
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-rename-merge1.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-rename-merge1.out	Thu Oct 04 19:44:37 2007 -0500
@@ -4,6 +4,17 @@
 resolving manifests
  overwrite None partial False
  ancestor af1939970a1c local f26ec4fc3fa3+ remote 8e765a822af2
+  searching for copies back to rev 1
+  unmatched files in local:
+   c2
+  unmatched files in other:
+   b
+   b2
+  all copies found (* = to merge, ! = divergent):
+   c2 -> a2 
+   b -> a *
+   b2 -> a2 
+  checking for directory renames
  a2: divergent renames -> dr
  a: remote moved to b -> m
  b2: remote created -> g
--- a/tests/test-up-local-change.out	Wed Oct 03 17:17:28 2007 -0500
+++ b/tests/test-up-local-change.out	Thu Oct 04 19:44:37 2007 -0500
@@ -17,6 +17,9 @@
 resolving manifests
  overwrite False partial False
  ancestor 33aaa84a386b local 33aaa84a386b+ remote 802f095af299
+  searching for copies back to rev 1
+  unmatched files in other:
+   b
  a: versions differ -> m
  b: remote created -> g
 merging a
@@ -50,6 +53,9 @@
 resolving manifests
  overwrite False partial False
  ancestor 33aaa84a386b local 33aaa84a386b+ remote 802f095af299
+  searching for copies back to rev 1
+  unmatched files in other:
+   b
  a: versions differ -> m
  b: remote created -> g
 merging a
@@ -100,6 +106,7 @@
 resolving manifests
  overwrite False partial False
  ancestor 33aaa84a386b local 802f095af299+ remote 030602aee63d
+  searching for copies back to rev 1
  a: versions differ -> m
  b: versions differ -> m
 merging a