From 708d51fe903124277d0183d0264812782df3492c Mon Sep 17 00:00:00 2001 From: Mateusz Kwapich Date: Wed, 25 Jan 2017 06:07:19 -0800 Subject: [PATCH] remotefilelog: ommit prefetching when commitctx has a manifest Summary: this is neccessary for the new metaedit to not spend time in remotefilelog Test Plan: tests are passing Reviewers: #sourcecontrol, rmcelroy, durham Reviewed By: durham Subscribers: durham, rmcelroy, quark, jeroenv, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4326589 Tasks: 14548013 Signature: t1:4326589:1485343332:df8f7f6169e148b4724b088878ca8dfff34e9275 --- remotefilelog/shallowrepo.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/remotefilelog/shallowrepo.py b/remotefilelog/shallowrepo.py index 9d52741341..7029c4ed0b 100644 --- a/remotefilelog/shallowrepo.py +++ b/remotefilelog/shallowrepo.py @@ -64,15 +64,20 @@ def wraprepo(repo): Revision information is passed via the context argument. """ - # prefetch files that will likely be compared - m1 = ctx.p1().manifest() - files = [] - for f in ctx.modified() + ctx.added(): - fparent1 = m1.get(f, nullid) - if fparent1 != nullid: - files.append((f, hex(fparent1))) - self.fileservice.prefetch(files) - return super(shallowrepository, self).commitctx(ctx, error=error) + # some contexts already have manifest nodes, they don't need any + # prefetching (for example if we're just editing a commit message + # we can reuse manifest + if not ctx.manifestnode(): + # prefetch files that will likely be compared + m1 = ctx.p1().manifest() + files = [] + for f in ctx.modified() + ctx.added(): + fparent1 = m1.get(f, nullid) + if fparent1 != nullid: + files.append((f, hex(fparent1))) + self.fileservice.prefetch(files) + return super(shallowrepository, self).commitctx(ctx, + error=error) def prefetch(self, revs, base=None, pats=None, opts=None): """Prefetches all the necessary file revisions for the given revs