[fastmanifest] have debugfastmanifest consistently return a fastmanifest

Summary:
When fastmanifest.debugfastmanifest is set to True, we always return a fastmanifest.  If the cache is empty, we will convert a flat manifest into a fastmanifest and use that for all operations.

Same goal as D3247484.

Test Plan: pass some unit tests in the mercurial suite.  need to investigate the remaining issues.

Reviewers: #mercurial, lcharignon

Reviewed By: lcharignon

Subscribers: mitrandir, mjpieters

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

Signature: t1:3295434:1463439017:0a6d20fa23fe409094e35a46eb195495455b8602
This commit is contained in:
Tony Tung 2016-05-16 16:13:03 -07:00
parent 13fa3e9044
commit 75a0702224

View File

@ -166,21 +166,20 @@ class hybridmanifest(object):
def _manifest(self, operation):
# Get the manifest most suited for the operations (flat or cached)
# TODO return fastmanifest when suitable
if self.debugfastmanifest:
if self.__cachedmanifest:
return self.__cachedmanifest
flatmanifest = self._flatmanifest().text()
fm = fastmanifest_wrapper.fastManifest(flatmanifest)
self.__cachedmanifest = fastmanifestdict(fm)
return self.__cachedmanifest
# TODO: return fastmanifest when suitable
c = self._cachedmanifest()
if c is not None:
return c
r = self._flatmanifest()
if self.debugfastmanifest:
# in debug mode, we always convert into a fastmanifest.
fm = fastmanifest_wrapper.fastManifest(r.text())
self.__cachedmanifest = fastmanifestdict(fm)
self.incache = True
return self.__cachedmanifest
return r
# Proxy all the manifest methods to the flatmanifest except magic methods