Mercurial > hg
changeset 30229:69ffbbe73dd0 stable
merge: avoid superfluous filemerges when grafting through renames (issue5407)
This is a fix for a regression introduced by the patches for issue4028.
The test changes are due to us doing fewer _checkcopies searches now, which
makes some test outputs revert to the pre-issue4028 behavior. That issue itself
remains fixed, we only skip copy tracing for files where it isn't relevant.
As a nice side effect, this makes copy detection much faster when tracing
backwards through lots of renames.
author | Gábor Stefanik <gabor.stefanik@nng.com> |
---|---|
date | Tue, 25 Oct 2016 21:01:53 +0200 |
parents | b9f7b0c10027 |
children | 46a0203dfb89 8b2056d9a7dd |
files | mercurial/copies.py tests/test-graft.t tests/test-merge-local.t tests/test-up-local-change.t |
diffstat | 4 files changed, 25 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/copies.py Wed Oct 19 18:06:14 2016 +0200 +++ b/mercurial/copies.py Tue Oct 25 21:01:53 2016 +0200 @@ -631,6 +631,10 @@ backwards = not remotebase and base != tca and f in mb getfctx = _makegetfctx(ctx) + if m1[f] == mb.get(f) and not remotebase: + # Nothing to merge + return + of = None seen = set([f]) for oc in getfctx(f, m1[f]).ancestors():
--- a/tests/test-graft.t Wed Oct 19 18:06:14 2016 +0200 +++ b/tests/test-graft.t Tue Oct 25 21:01:53 2016 +0200 @@ -181,9 +181,6 @@ searching for copies back to rev 1 unmatched files in other (from topological common ancestor): c - all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'c' -> dst: 'b' * - checking for directory renames resolving manifests branchmerge: True, force: True, partial: False ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 @@ -200,9 +197,6 @@ searching for copies back to rev 1 unmatched files in other (from topological common ancestor): c - all copies found (* = to merge, ! = divergent, % = renamed and deleted): - src: 'c' -> dst: 'b' * - checking for directory renames resolving manifests branchmerge: True, force: True, partial: False ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d @@ -1280,3 +1274,15 @@ $ hg cat f2c c2e + +Check superfluous filemerge of files renamed in the past but untouched by graft + + $ echo a > a + $ hg ci -qAma + $ hg mv a b + $ echo b > b + $ hg ci -qAmb + $ echo c > c + $ hg ci -qAmc + $ hg up -q .~2 + $ hg graft tip -qt:fail
--- a/tests/test-merge-local.t Wed Oct 19 18:06:14 2016 +0200 +++ b/tests/test-merge-local.t Tue Oct 25 21:01:53 2016 +0200 @@ -66,7 +66,7 @@ merging zzz1_merge_ok merging zzz2_merge_bad warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark') - 2 files updated, 1 files merged, 2 files removed, 1 files unresolved + 2 files updated, 1 files merged, 3 files removed, 1 files unresolved use 'hg resolve' to retry unresolved file merges [1] @@ -104,7 +104,7 @@ merging zzz1_merge_ok merging zzz2_merge_bad warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark') - 2 files updated, 1 files merged, 2 files removed, 1 files unresolved + 2 files updated, 1 files merged, 3 files removed, 1 files unresolved use 'hg resolve' to retry unresolved file merges [1]
--- a/tests/test-up-local-change.t Wed Oct 19 18:06:14 2016 +0200 +++ b/tests/test-up-local-change.t Tue Oct 25 21:01:53 2016 +0200 @@ -242,4 +242,11 @@ -a +b +test for superfluous filemerge of clean files renamed in the past + + $ hg up -qC tip + $ echo c > c + $ hg add c + $ hg up -qt:fail 0 + $ cd ..