diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -495,7 +495,9 @@ def perftags(ui, repo, **opts): repocleartagscache = repocleartagscachefunc(repo) def t(): repo.changelog = mercurial.changelog.changelog(svfs) - repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo) + rootmanifest = mercurial.manifest.manifestrevlog(svfs) + repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo, + rootmanifest) repocleartagscache() return len(repo.tags()) timer(t) diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -364,14 +364,16 @@ class bundlerepository(object): self.manstart = self._cgunpacker.tell() return c - def _constructmanifest(self): + @localrepo.unfilteredpropertycache + def manifestlog(self): self._cgunpacker.seek(self.manstart) # consume the header if it exists self._cgunpacker.manifestheader() linkmapper = self.unfiltered().changelog.rev - m = bundlemanifest(self.svfs, self._cgunpacker, linkmapper) + rootstore = bundlemanifest(self.svfs, self._cgunpacker, linkmapper) self.filestart = self._cgunpacker.tell() - return m + + return manifest.manifestlog(self.svfs, self, rootstore) def _consumemanifest(self): """Consumes the manifest portion of the bundle, setting filestart so the diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -994,15 +994,10 @@ class localrepository(object): return changelog.changelog(self.svfs, trypending=txnutil.mayhavepending(self.root)) - def _constructmanifest(self): - # This is a temporary function while we migrate from manifest to - # manifestlog. It allows bundlerepo and unionrepo to intercept the - # manifest creation. - return manifest.manifestrevlog(self.svfs) - @storecache('00manifest.i') def manifestlog(self): - return manifest.manifestlog(self.svfs, self) + rootstore = manifest.manifestrevlog(self.svfs) + return manifest.manifestlog(self.svfs, self, rootstore) @repofilecache('dirstate') def dirstate(self): diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1609,7 +1609,7 @@ class manifestlog(object): of the list of files in the given commit. Consumers of the output of this class do not care about the implementation details of the actual manifests they receive (i.e. tree or flat or lazily loaded, etc).""" - def __init__(self, opener, repo): + def __init__(self, opener, repo, rootstore): usetreemanifest = False cachesize = 4 @@ -1620,7 +1620,7 @@ class manifestlog(object): self._treemanifests = usetreemanifest - self._rootstore = repo._constructmanifest() + self._rootstore = rootstore self._rootstore._setupmanifestcachehooks(repo) self._narrowmatch = repo.narrowmatch() diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -185,7 +185,8 @@ class statichttprepository(localrepo.loc self._filecache = {} self.requirements = requirements - self.manifestlog = manifest.manifestlog(self.svfs, self) + rootmanifest = manifest.manifestrevlog(self.svfs) + self.manifestlog = manifest.manifestlog(self.svfs, self, rootmanifest) self.changelog = changelog.changelog(self.svfs) self._tags = None self.nodetagscache = None diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py --- a/mercurial/unionrepo.py +++ b/mercurial/unionrepo.py @@ -208,6 +208,12 @@ class unionrepository(object): def changelog(self): return unionchangelog(self.svfs, self.repo2.svfs) + @localrepo.unfilteredpropertycache + def manifestlog(self): + rootstore = unionmanifest(self.svfs, self.repo2.svfs, + self.unfiltered()._clrev) + return manifest.manifestlog(self.svfs, self, rootstore) + def _clrev(self, rev2): """map from repo2 changelog rev to temporary rev in self.changelog""" node = self.repo2.changelog.node(rev2) diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py --- a/tests/test-check-interfaces.py +++ b/tests/test-check-interfaces.py @@ -184,7 +184,7 @@ def main(): checkzobject(fl, allowextra=True) # Conforms to imanifestlog. - ml = manifest.manifestlog(vfs, repo) + ml = manifest.manifestlog(vfs, repo, manifest.manifestrevlog(repo.svfs)) checkzobject(ml) checkzobject(repo.manifestlog)