# HG changeset patch # User Stanislau Hlebik # Date 2017-05-29 13:06:13 # Node ID 5313d98089f569efffaca25de60e73be04156713 # Parent 6966e42f833adcc2c8f5530a2cb06d7077cdb06b copies: introduce getdstfctx Previously `c2` may had an incorrect linkrev because getsrcfctx set wrong _descendantrev. getsrcfctx() sets descendant rev equals to srcctx.rev() (see _makegetfctx()), but for `c2` descendant rev should be dstctx. While we were lucky it didn't broke copytracing it made it significantly slower in some cases. Besides it broke some external extensions, for example remotefilelog. diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -632,6 +632,7 @@ def _checkcopies(srcctx, dstctx, f, base # We use 'backwards = False' in that case. backwards = not remotebase and base != tca and f in mb getsrcfctx = _makegetfctx(srcctx) + getdstfctx = _makegetfctx(dstctx) if msrc[f] == mb.get(f) and not remotebase: # Nothing to merge @@ -658,7 +659,7 @@ def _checkcopies(srcctx, dstctx, f, base continue # no match, keep looking if mdst[of] == mb.get(of): return # no merge needed, quit early - c2 = getsrcfctx(of, mdst[of]) + c2 = getdstfctx(of, mdst[of]) # c2 might be a plain new file on added on destination side that is # unrelated to the droids we are looking for. cr = _related(oc, c2, tca.rev())