changeset 4304:4787e2b0dd03

merge: fix a bug where copies were ignored
author Matt Mackall <mpm@selenic.com>
date Thu, 05 Apr 2007 16:43:18 -0500
parents 8185a1ca8628
children 5e05007d3857 43dedce9667e
files mercurial/merge.py tests/test-merge-local.out tests/test-merge8.out tests/test-rename-dir-merge.out tests/test-rename-dir-merge2.out tests/test-rename-merge2.out
diffstat 6 files changed, 42 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Mar 23 00:12:28 2007 -0500
+++ b/mercurial/merge.py	Thu Apr 05 16:43:18 2007 -0500
@@ -129,15 +129,15 @@
         '''check possible copies for filectx c'''
         for of in findold(c):
             if of not in man:
-                return
+                continue
             c2 = ctx(of, man[of])
             ca = c.ancestor(c2)
             if not ca: # unrelated
-                return
+                continue
             if ca.path() == c.path() or ca.path() == c2.path():
                 fullcopy[c.path()] = of
-                if c == ca or c2 == ca: # no merge needed, ignore copy
-                    return
+                if c == ca and c2 == ca: # no merge needed, ignore copy
+                    continue
                 copy[c.path()] = of
 
     def dirs(files):
--- a/tests/test-merge-local.out	Fri Mar 23 00:12:28 2007 -0500
+++ b/tests/test-merge-local.out	Thu Apr 05 16:43:18 2007 -0500
@@ -21,7 +21,7 @@
 merging zzz1_merge_ok failed!
 merging zzz2_merge_bad
 merging zzz2_merge_bad failed!
-3 files updated, 0 files merged, 2 files removed, 2 files unresolved
+3 files updated, 0 files merged, 1 files removed, 2 files unresolved
 There are unresolved merges with locally modified files.
 You can redo the full merge using:
   hg update 0
@@ -40,7 +40,7 @@
 merging zzz1_merge_ok
 merging zzz2_merge_bad
 merging zzz2_merge_bad failed!
-3 files updated, 1 files merged, 2 files removed, 1 files unresolved
+3 files updated, 1 files merged, 1 files removed, 1 files unresolved
 There are unresolved merges with locally modified files.
 You can finish the partial merge using:
   hg update 0
@@ -59,7 +59,7 @@
 M zzz2_merge_bad
 # local merge without conflicts
 merging zzz1_merge_ok
-4 files updated, 1 files merged, 2 files removed, 0 files unresolved
+4 files updated, 1 files merged, 1 files removed, 0 files unresolved
 --- a/zzz1_merge_ok
 +++ b/zzz1_merge_ok
 +new last line
--- a/tests/test-merge8.out	Fri Mar 23 00:12:28 2007 -0500
+++ b/tests/test-merge8.out	Thu Apr 05 16:43:18 2007 -0500
@@ -6,4 +6,5 @@
 adding file changes
 added 2 changesets with 2 changes to 1 files
 (run 'hg update' to get a working copy)
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+merging a and b
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-rename-dir-merge.out	Fri Mar 23 00:12:28 2007 -0500
+++ b/tests/test-rename-dir-merge.out	Thu Apr 05 16:43:18 2007 -0500
@@ -10,33 +10,39 @@
  overwrite None partial False
  ancestor f9b20c0d4c51 local ce36d17b18fb+ remote 55119e611c80
  a/c: remote renamed directory to b/c -> d
- a/b: other deleted -> r
- a/a: other deleted -> r
- b/a: remote created -> g
- b/b: remote created -> g
+ a/a: remote moved to b/a -> m
+ a/b: remote moved to b/b -> m
+copying a/a to b/a
 removing a/a
+copying a/b to b/b
 removing a/b
 moving a/c to b/c
-getting b/a
-getting b/b
-3 files updated, 0 files merged, 2 files removed, 0 files unresolved
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 a/* b/a b/b b/c
 M b/a
+  a/a
 M b/b
+  a/b
 A b/c
   a/c
 R a/a
 R a/b
 R a/c
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+2 files updated, 0 files merged, 1 files removed, 0 files unresolved
 resolving manifests
  overwrite None partial False
  ancestor f9b20c0d4c51 local 55119e611c80+ remote ce36d17b18fb
+ b/a: local moved to a/a -> m
+ b/b: local moved to a/b -> m
  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
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 a/* b/a b/b b/c
+M b/a
+  a/a
+M b/b
+  a/b
 A b/c
   a/c
--- a/tests/test-rename-dir-merge2.out	Fri Mar 23 00:12:28 2007 -0500
+++ b/tests/test-rename-dir-merge2.out	Thu Apr 05 16:43:18 2007 -0500
@@ -10,9 +10,11 @@
 adding file changes
 added 1 changesets with 1 changes to 1 files (+1 heads)
 (run 'hg heads' to see heads, 'hg merge' to merge)
-2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+merging a/f and b/f
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 M b/f
+  a/f
 A b/aa/g
   a/aa/g
 R a/aa/g
--- a/tests/test-rename-merge2.out	Fri Mar 23 00:12:28 2007 -0500
+++ b/tests/test-rename-merge2.out	Thu Apr 05 16:43:18 2007 -0500
@@ -88,14 +88,15 @@
  overwrite None partial False
  ancestor 924404dff337 local 94b33a1b7f2d+ remote 735846fee2d7
  rev: versions differ -> m
- b: remote created -> g
-getting b
+ a: remote copied to b -> m
+copying a to b
 merging rev
 my rev@94b33a1b7f2d+ other rev@735846fee2d7 ancestor rev@924404dff337
 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
 M b
+  a
 C a
 --------------
 
@@ -105,14 +106,16 @@
 resolving manifests
  overwrite None partial False
  ancestor 924404dff337 local ac809aeed39a+ remote 97c705ade336
+ b: local copied to a -> m
  rev: versions differ -> m
 merging rev
 my rev@ac809aeed39a+ other rev@97c705ade336 ancestor rev@924404dff337
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
+M b
+  a
 C a
-C b
 --------------
 
 --------------
@@ -121,17 +124,17 @@
 resolving manifests
  overwrite None partial False
  ancestor 924404dff337 local 94b33a1b7f2d+ remote e03727d2d66b
- a: other deleted -> r
  rev: versions differ -> m
- b: remote created -> g
+ a: remote moved to b -> m
+copying a to b
 removing a
-getting b
 merging rev
 my rev@94b33a1b7f2d+ other rev@e03727d2d66b ancestor rev@924404dff337
-1 files updated, 1 files merged, 1 files removed, 0 files unresolved
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
 M b
+  a
 --------------
 
 --------------
@@ -140,13 +143,15 @@
 resolving manifests
  overwrite None partial False
  ancestor 924404dff337 local ecf3cb2a4219+ remote 97c705ade336
+ b: local moved to a -> m
  rev: versions differ -> m
 merging rev
 my rev@ecf3cb2a4219+ other rev@97c705ade336 ancestor rev@924404dff337
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
-C b
+M b
+  a
 --------------
 
 --------------