changeset 30219:3c8811efdddc stable

manifest: make manifestlog a storecache The old @property on manifestlog was broken. It meant that we would always recreate the manifestlog instance, which meant the cache was never hit. Since we'll eventually remove repo.manifest and make manifestlog the only property, let's go ahead and make manifestlog the @storecache property, have manifestlog own the manifest instance, and have repo.manifest refer to it via manifestlog. This means all accesses go through repo.manifestlog, which is now invalidated correctly.
author Durham Goode <durham@fb.com>
date Tue, 18 Oct 2016 17:33:39 -0700
parents 1767723f71cf
children acc8885a6450
files contrib/perf.py mercurial/localrepo.py mercurial/manifest.py mercurial/statichttprepo.py
diffstat 4 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Tue Oct 18 17:32:51 2016 -0700
+++ b/contrib/perf.py	Tue Oct 18 17:33:39 2016 -0700
@@ -407,7 +407,7 @@
     repocleartagscache = repocleartagscachefunc(repo)
     def t():
         repo.changelog = mercurial.changelog.changelog(svfs)
-        repo.manifest = mercurial.manifest.manifest(svfs)
+        repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo)
         repocleartagscache()
         return len(repo.tags())
     timer(t)
--- a/mercurial/localrepo.py	Tue Oct 18 17:32:51 2016 -0700
+++ b/mercurial/localrepo.py	Tue Oct 18 17:33:39 2016 -0700
@@ -504,9 +504,9 @@
                 c.readpending('00changelog.i.a')
         return c
 
-    @storecache('00manifest.i')
+    @property
     def manifest(self):
-        return self._constructmanifest()
+        return self.manifestlog._oldmanifest
 
     def _constructmanifest(self):
         # This is a temporary function while we migrate from manifest to
@@ -514,7 +514,7 @@
         # manifest creation.
         return manifest.manifest(self.svfs)
 
-    @property
+    @storecache('00manifest.i')
     def manifestlog(self):
         return manifest.manifestlog(self.svfs, self)
 
--- a/mercurial/manifest.py	Tue Oct 18 17:32:51 2016 -0700
+++ b/mercurial/manifest.py	Tue Oct 18 17:33:39 2016 -0700
@@ -1254,13 +1254,12 @@
             usetreemanifest = opts.get('treemanifest', usetreemanifest)
         self._treeinmem = usetreemanifest
 
+        self._oldmanifest = repo._constructmanifest()
+        self._revlog = self._oldmanifest
+
         # We'll separate this into it's own cache once oldmanifest is no longer
         # used
-        self._mancache = repo.manifest._mancache
-
-    @property
-    def _revlog(self):
-        return self._repo.manifest
+        self._mancache = self._oldmanifest._mancache
 
     def __getitem__(self, node):
         """Retrieves the manifest instance for the given node. Throws a KeyError
--- a/mercurial/statichttprepo.py	Tue Oct 18 17:32:51 2016 -0700
+++ b/mercurial/statichttprepo.py	Tue Oct 18 17:33:39 2016 -0700
@@ -155,7 +155,7 @@
         self._filecache = {}
         self.requirements = requirements
 
-        self.manifest = manifest.manifest(self.svfs)
+        self.manifestlog = manifest.manifestlog(self.svfs, self)
         self.changelog = changelog.changelog(self.svfs)
         self._tags = None
         self.nodetagscache = None