From patchwork Mon May 29 13:12:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7,of,7] copies: introduce getdstfctx From: Stanislau Hlebik X-Patchwork-Id: 21038 Message-Id: <337ac332b0a1260583c8.1496063523@devvm1840.lla2.facebook.com> To: Date: Mon, 29 May 2017 06:12:03 -0700 # HG changeset patch # User Stanislau Hlebik # Date 1496063173 25200 # Mon May 29 06:06:13 2017 -0700 # Node ID 337ac332b0a1260583c82a3bf346a304a9245ff1 # Parent 216a6a72c032ab10e8cc8dc6f916593508dc0a45 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 @@ # 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 @@ 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())