# HG changeset patch # User Matt Mackall # Date 2006-11-18 17:34:19 # Node ID 9103dab960932c5b1337dc6dad361437ce9a84e9 # Parent eb0b4a2d70a9c650d22bad9df0772878af0ac4e0 avoid unnecessary copy merges diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -139,6 +139,8 @@ def findcopies(repo, m1, m2, ma, limit): ''' 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() diff --git a/tests/test-merge8.out b/tests/test-merge8.out --- a/tests/test-merge8.out +++ b/tests/test-merge8.out @@ -6,5 +6,4 @@ adding manifests 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 diff --git a/tests/test-rename-merge2.out b/tests/test-rename-merge2.out --- a/tests/test-rename-merge2.out +++ b/tests/test-rename-merge2.out @@ -88,15 +88,14 @@ resolving manifests 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 @@ test L:nc a b R: W: - 6 not 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 @@ test L: R:nm a b W: - 7 get 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 @@ test L:nm a b R: W: - 8 not 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 -------------- --------------