Mercurial > hg-stable
changeset 3311:966632304dde
merge: shortcircuit filemerge for identical files
- use filectx.cmp to compare files
- move merge messages into filemerge
- kill the redundant resolving message
- update tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 10 Oct 2006 01:16:06 -0500 |
parents | 0e370798eebf |
children | c5075ad5e3e9 |
files | mercurial/merge.py tests/test-filebranch.out tests/test-flags.out tests/test-merge-revert.out tests/test-merge1.out tests/test-merge7.out tests/test-rename-merge1.out tests/test-rename-merge2.out tests/test-up-local-change.out |
diffstat | 9 files changed, 18 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Tue Oct 10 01:13:03 2006 -0500 +++ b/mercurial/merge.py Tue Oct 10 01:16:06 2006 -0500 @@ -32,6 +32,10 @@ fcm = wctx.filectx(fw) fco = mctx.filectx(fo) + + if not fco.cmp(fcm.data()): # files identical? + return 0 + fca = fcm.ancestor(fco) if not fca: fca = repo.filectx(fw, fileid=-1) @@ -39,7 +43,11 @@ b = temp("base", fca) c = temp("other", fco) - repo.ui.note(_("resolving %s\n") % fw) + if fw != fo: + repo.ui.status(_("merging %s and %s\n") % (fw, fo)) + else: + repo.ui.status(_("merging %s\n") % fw) + repo.ui.debug(_("my %s other %s ancestor %s\n") % (fcm, fco, fca)) cmd = (os.environ.get("HGMERGE") or repo.ui.config("ui", "merge") @@ -281,10 +289,6 @@ removed +=1 elif m == "m": # merge f2, fd, flag, move = a[2:] - if f != f2: - repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd)) - else: - repo.ui.status(_("merging %s\n") % f) if filemerge(repo, f, f2, wctx, mctx): unresolved += 1 else:
--- a/tests/test-filebranch.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-filebranch.out Tue Oct 10 01:16:06 2006 -0500 @@ -19,7 +19,6 @@ resolving manifests getting bar merging foo -resolving foo 1 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) we shouldn't have anything but foo in merge state here
--- a/tests/test-flags.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-flags.out Tue Oct 10 01:16:06 2006 -0500 @@ -44,7 +44,6 @@ resolving manifests merging a -resolving a 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) -rwxr-x---
--- a/tests/test-merge-revert.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-merge-revert.out Tue Oct 10 01:16:06 2006 -0500 @@ -11,7 +11,6 @@ ? file1.orig 016807e6fdaf tip 1 files updated, 0 files merged, 0 files removed, 0 files unresolved -merging file1 0 files updated, 1 files merged, 0 files removed, 0 files unresolved ? file1.orig 016807e6fdaf tip
--- a/tests/test-merge1.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-merge1.out Tue Oct 10 01:16:06 2006 -0500 @@ -1,7 +1,5 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved %% no merges expected -merging for b -merging b 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -19,8 +17,6 @@ %% merge fails abort: outstanding uncommitted changes %% merge expected! -merging for b -merging b 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-merge7.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-merge7.out Tue Oct 10 01:16:06 2006 -0500 @@ -26,7 +26,6 @@ ancestor 451c744aabcc local a070d41e8360 remote faaea63e63a9 test.txt: versions differ -> m merging test.txt -resolving test.txt my test.txt@. other test.txt@a070d41e8360 ancestor test.txt@faaea63e63a9 merging test.txt failed! 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
--- a/tests/test-rename-merge1.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-rename-merge1.out Tue Oct 10 01:16:06 2006 -0500 @@ -6,8 +6,7 @@ ancestor f26ec4fc3fa3 local 8e765a822af2 remote af1939970a1c a: remote moved -> m b2: remote created -> g -merging a and b to b -resolving a +merging a and b my a@. other b@8e765a822af2 ancestor a@af1939970a1c copying a to b removing a
--- a/tests/test-rename-merge2.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-rename-merge2.out Tue Oct 10 01:16:06 2006 -0500 @@ -6,12 +6,10 @@ ancestor e300d1c794ec local 735846fee2d7 remote 924404dff337 rev: versions differ -> m a: remote copied -> m -merging a and b to b -resolving a +merging a and b my a@. other b@735846fee2d7 ancestor a@924404dff337 copying a to b merging rev -resolving rev my rev@. other rev@735846fee2d7 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -31,11 +29,9 @@ b: local copied -> m rev: versions differ -> m getting a -merging b and a to b -resolving b +merging b and a my b@. other a@f4db7e329e71 ancestor a@924404dff337 merging rev -resolving rev my rev@. other rev@f4db7e329e71 ancestor rev@924404dff337 1 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -53,13 +49,11 @@ ancestor e300d1c794ec local e03727d2d66b remote 924404dff337 a: remote moved -> m rev: versions differ -> m -merging a and b to b -resolving a +merging a and b my a@. other b@e03727d2d66b ancestor a@924404dff337 copying a to b removing a merging rev -resolving rev my rev@. other rev@e03727d2d66b ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -76,11 +70,9 @@ ancestor ecf3cb2a4219 local f4db7e329e71 remote 924404dff337 b: local moved -> m rev: versions differ -> m -merging b and a to b -resolving b +merging b and a my b@. other a@f4db7e329e71 ancestor a@924404dff337 merging rev -resolving rev my rev@. other rev@f4db7e329e71 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -97,19 +89,15 @@ ancestor 94b33a1b7f2d local 735846fee2d7 remote 924404dff337 rev: versions differ -> m a: remote copied -> m -merging a and b to b -resolving a -my a@. other b@735846fee2d7 ancestor a@924404dff337 copying a to b merging rev -resolving rev my rev@. other rev@735846fee2d7 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) -------------- -M a M b a +C a -------------- -------------- @@ -120,11 +108,7 @@ ancestor ac809aeed39a local 97c705ade336 remote 924404dff337 b: local copied -> m rev: versions differ -> m -merging b and a to b -resolving b -my b@. other a@97c705ade336 ancestor a@924404dff337 merging rev -resolving rev my rev@. other rev@97c705ade336 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -142,13 +126,9 @@ ancestor 94b33a1b7f2d local e03727d2d66b remote 924404dff337 a: remote moved -> m rev: versions differ -> m -merging a and b to b -resolving a -my a@. other b@e03727d2d66b ancestor a@924404dff337 copying a to b removing a merging rev -resolving rev my rev@. other rev@e03727d2d66b ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -165,11 +145,7 @@ ancestor ecf3cb2a4219 local 97c705ade336 remote 924404dff337 b: local moved -> m rev: versions differ -> m -merging b and a to b -resolving b -my b@. other a@97c705ade336 ancestor a@924404dff337 merging rev -resolving rev my rev@. other rev@97c705ade336 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -187,10 +163,8 @@ b: versions differ -> m rev: versions differ -> m merging b -resolving b my b@. other b@79cc6877a3b7 ancestor a@924404dff337 merging rev -resolving rev my rev@. other rev@79cc6877a3b7 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -208,7 +182,6 @@ c: remote created -> g getting c merging rev -resolving rev my rev@. other rev@e6abcc1a30c2 ancestor rev@924404dff337 1 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -226,10 +199,8 @@ b: versions differ -> m rev: versions differ -> m merging b -resolving b my b@. other b@af30c7647fc7 ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@af30c7647fc7 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -249,10 +220,8 @@ rev: versions differ -> m removing a merging b -resolving b my b@. other b@e03727d2d66b ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@e03727d2d66b ancestor rev@924404dff337 0 files updated, 2 files merged, 1 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -271,10 +240,8 @@ rev: versions differ -> m getting a merging b -resolving b my b@. other b@8dbce441892a ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@8dbce441892a ancestor rev@924404dff337 1 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -294,10 +261,8 @@ rev: versions differ -> m removing a merging b -resolving b my b@. other b@e03727d2d66b ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@e03727d2d66b ancestor rev@924404dff337 0 files updated, 2 files merged, 1 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -316,10 +281,8 @@ rev: versions differ -> m getting a merging b -resolving b my b@. other b@8dbce441892a ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@8dbce441892a ancestor rev@924404dff337 1 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -337,10 +300,8 @@ b: versions differ -> m rev: versions differ -> m merging b -resolving b my b@. other b@735846fee2d7 ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@735846fee2d7 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -360,10 +321,8 @@ a: prompt recreating -> g getting a merging b -resolving b my b@. other b@8dbce441892a ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@8dbce441892a ancestor rev@924404dff337 1 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -381,10 +340,8 @@ b: versions differ -> m rev: versions differ -> m merging b -resolving b my b@. other b@e03727d2d66b ancestor b@000000000000 merging rev -resolving rev my rev@. other rev@e03727d2d66b ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -401,13 +358,11 @@ ancestor e300d1c794ec local 79cc6877a3b7 remote 924404dff337 a: remote moved -> m rev: versions differ -> m -merging a and b to b -resolving a +merging a and b my a@. other b@79cc6877a3b7 ancestor a@924404dff337 copying a to b removing a merging rev -resolving rev my rev@. other rev@79cc6877a3b7 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -424,11 +379,9 @@ ancestor ec03c2ca8642 local f4db7e329e71 remote 924404dff337 b: local moved -> m rev: versions differ -> m -merging b and a to b -resolving b +merging b and a my b@. other a@f4db7e329e71 ancestor a@924404dff337 merging rev -resolving rev my rev@. other rev@f4db7e329e71 ancestor rev@924404dff337 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -446,12 +399,10 @@ b: local moved -> m rev: versions differ -> m c: remote created -> g -merging b and a to b -resolving b +merging b and a my b@. other a@2b958612230f ancestor a@924404dff337 getting c merging rev -resolving rev my rev@. other rev@2b958612230f ancestor rev@924404dff337 1 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit)
--- a/tests/test-up-local-change.out Tue Oct 10 01:13:03 2006 -0500 +++ b/tests/test-up-local-change.out Tue Oct 10 01:16:06 2006 -0500 @@ -20,7 +20,6 @@ a: versions differ -> m b: remote created -> g merging a -resolving a my a@. other a@802f095af299 ancestor a@33aaa84a386b getting b 1 files updated, 1 files merged, 0 files removed, 0 files unresolved @@ -54,7 +53,6 @@ a: versions differ -> m b: remote created -> g merging a -resolving a my a@. other a@802f095af299 ancestor a@33aaa84a386b getting b 1 files updated, 1 files merged, 0 files removed, 0 files unresolved @@ -105,10 +103,8 @@ a: versions differ -> m b: versions differ -> m merging a -resolving a my a@. other a@030602aee63d ancestor a@33aaa84a386b merging b -resolving b my b@. other b@030602aee63d ancestor b@000000000000 0 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -137,5 +133,4 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files -merging a 0 files updated, 1 files merged, 0 files removed, 0 files unresolved