changeset 29826:93b44aa17691

manifest: use property instead of field for manifest revlog storage The file caches we're using to avoid reloading the manifest from disk everytime has an annoying bug that causes the in memory structure to not be reloaded if the mtime and the size haven't changed. This causes a breakage in the tests because the manifestlog is not being reloaded after a commit+strip operation in mq (the mtime is the same because it all happens in the same second, and the resulting size is the same because we add 1 and remove 1). The only reason this doesn't affect the manifest itself is because we touch it so often that we had already reloaded it after the commit, but before the strip. Once the entire manifest has migrated to manifestlog, we can get rid of these properties, since then the manifestlog will be touched after the commit, but before the strip, as well.
author Durham Goode <durham@fb.com>
date Wed, 17 Aug 2016 13:25:13 -0700
parents 426d931e5db2
children a22b3de3b65a
files mercurial/localrepo.py mercurial/manifest.py
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Aug 17 13:25:13 2016 -0700
+++ b/mercurial/localrepo.py	Wed Aug 17 13:25:13 2016 -0700
@@ -504,9 +504,9 @@
     def manifest(self):
         return manifest.manifest(self.svfs)
 
-    @storecache('00manifest.i')
+    @property
     def manifestlog(self):
-        return manifest.manifestlog(self.svfs, self.manifest)
+        return manifest.manifestlog(self.svfs, self)
 
     @repofilecache('dirstate')
     def dirstate(self):
--- a/mercurial/manifest.py	Wed Aug 17 13:25:13 2016 -0700
+++ b/mercurial/manifest.py	Wed Aug 17 13:25:13 2016 -0700
@@ -922,17 +922,23 @@
     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, oldmanifest):
-        self._revlog = oldmanifest
+    def __init__(self, opener, repo):
+        self._repo = repo
 
         # We'll separate this into it's own cache once oldmanifest is no longer
         # used
-        self._mancache = oldmanifest._mancache
+        self._mancache = repo.manifest._mancache
 
+    @property
+    def _revlog(self):
+        return self._repo.manifest
+
+    @property
+    def _oldmanifest(self):
         # _revlog is the same as _oldmanifest right now, but we eventually want
         # to delete _oldmanifest while still allowing manifestlog to access the
         # revlog specific apis.
-        self._oldmanifest = oldmanifest
+        return self._repo.manifest
 
     def __getitem__(self, node):
         """Retrieves the manifest instance for the given node. Throws a KeyError