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
This commit is contained in:
Mateusz Kwapich 2017-01-25 06:07:19 -08:00
parent e6f821ac7d
commit 708d51fe90

View File

@ -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