changeset 3674:9103dab96093

avoid unnecessary copy merges
author Matt Mackall <mpm@selenic.com>
date Sat, 18 Nov 2006 11:34:19 -0600
parents eb0b4a2d70a9
children 6990e499d71a
files mercurial/merge.py tests/test-merge8.out tests/test-rename-merge2.out
diffstat 3 files changed, 13 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Nov 17 08:06:54 2006 +0100
+++ b/mercurial/merge.py	Sat Nov 18 11:34:19 2006 -0600
@@ -139,6 +139,8 @@
         ''' check if an apparent pair actually matches '''
         c2 = ctx(f2, man[f2])
         ca = c.ancestor(c2)
+        if c == ca or c2 == ca:
+            return
         if ca and ca.path() == c.path() or ca.path() == c2.path():
             copy[c.path()] = f2
             copy[f2] = c.path()
--- a/tests/test-merge8.out	Fri Nov 17 08:06:54 2006 +0100
+++ b/tests/test-merge8.out	Sat Nov 18 11:34:19 2006 -0600
@@ -6,5 +6,4 @@
 adding file changes
 added 2 changesets with 2 changes to 1 files
 (run 'hg update' to get a working copy)
-merging a and b
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
--- a/tests/test-rename-merge2.out	Fri Nov 17 08:06:54 2006 +0100
+++ b/tests/test-rename-merge2.out	Sat Nov 18 11:34:19 2006 -0600
@@ -88,15 +88,14 @@
  overwrite None partial False
  ancestor 924404dff337 local 94b33a1b7f2d+ remote 735846fee2d7
  rev: versions differ -> m
- a: remote copied -> m
-copying a to b
+ b: remote created -> g
+getting 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
 --------------
 
@@ -106,16 +105,14 @@
 resolving manifests
  overwrite None partial False
  ancestor 924404dff337 local ac809aeed39a+ remote 97c705ade336
- b: local copied -> m
  rev: versions differ -> m
 merging rev
 my rev@ac809aeed39a+ other rev@97c705ade336 ancestor rev@924404dff337
-1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+0 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
 --------------
 
 --------------
@@ -124,17 +121,17 @@
 resolving manifests
  overwrite None partial False
  ancestor 924404dff337 local 94b33a1b7f2d+ remote e03727d2d66b
- a: remote moved -> m
+ a: other deleted -> r
  rev: versions differ -> m
-copying a to b
+ b: remote created -> g
 removing a
+getting b
 merging rev
 my rev@94b33a1b7f2d+ other rev@e03727d2d66b ancestor rev@924404dff337
-1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+1 files updated, 1 files merged, 1 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
 M b
-  a
 --------------
 
 --------------
@@ -143,15 +140,13 @@
 resolving manifests
  overwrite None partial False
  ancestor 924404dff337 local ecf3cb2a4219+ remote 97c705ade336
- b: local moved -> m
  rev: versions differ -> m
 merging rev
 my rev@ecf3cb2a4219+ other rev@97c705ade336 ancestor rev@924404dff337
-1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
-M b
-  a
+C b
 --------------
 
 --------------