fastmanifest: fallback to old manifest in readshallowfast

Summary:
fastmanifest makes bundling slower because fastmanifest `readshallowfast` always returns full manifest.
That's a big problem for infinitepush.
Let's copy-paste readshallowfast implementation from upstream. It uses readshallowdelta() if possible.

Test Plan:
1) Run all the tests for fb-hgext
2) Run infinitepush with this extension enabled. Make it is fast

Reviewers: durham, simonfar, rmcelroy, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4088360

Tasks: 13907166

Signature: t1:4088360:1477580931:746e4054380403abbc52d1922583021b81f31bb6
This commit is contained in:
Stanislau Hlebik 2016-10-27 09:23:05 -07:00
parent 79b9423cee
commit 8b420cd314
2 changed files with 18 additions and 1 deletions

View File

@ -221,7 +221,7 @@ class FastManifestExtension(object):
extensions.wrapfunction(manifest.manifest, 'read', factory.read) extensions.wrapfunction(manifest.manifest, 'read', factory.read)
try: try:
extensions.wrapfunction(manifest.manifest, 'readshallowfast', extensions.wrapfunction(manifest.manifest, 'readshallowfast',
factory.read) factory.readshallowfast)
except AttributeError: except AttributeError:
# The function didn't use to be defined in previous versions # The function didn't use to be defined in previous versions
# of hg # of hg

View File

@ -779,6 +779,23 @@ class manifestfactory(object):
loadflat=lambda: orig(*args, **kwargs), loadflat=lambda: orig(*args, **kwargs),
node=args[1]) node=args[1])
def readshallowfast(self, orig, *args, **kwargs):
# copy-paste from manifest.readshallowfast
manifest = args[0]
if len(args) == 2:
node = args[1]
else:
node = kwargs['node']
r = manifest.rev(node)
deltaparent = manifest.deltaparent(r)
if (deltaparent != revlog.nullrev and
deltaparent in manifest.parentrevs(r)):
return manifest.readshallowdelta(node)
return hybridmanifest(self.ui,
args[0].opener,
loadflat=lambda: orig(*args, **kwargs),
node=args[1])
def newgetitem(self, orig, *args, **kwargs): def newgetitem(self, orig, *args, **kwargs):
# args[0] == instance of manifestlog # args[0] == instance of manifestlog
# args[1] = node # args[1] = node