manifest: make manifestlog use it's own cache
authorDurham Goode <durham@fb.com>
Thu, 10 Nov 2016 02:13:19 -0800
changeset 30372 7c7d845f8b64
parent 30371 fccc3eea2ddb
child 30373 31de088945cd
manifest: make manifestlog use it's own cache As we start to make manifestlog the primary manifest source, the dependency on manifest.manifest will cause circular dependency problems. Let's break this dependency by making manifestlog use it's own cache. In a near future patch we will remove the previous manifest cache so we're not duplicating it.
mercurial/manifest.py
--- a/mercurial/manifest.py	Thu Nov 10 02:13:19 2016 -0800
+++ b/mercurial/manifest.py	Thu Nov 10 02:13:19 2016 -0800
@@ -1255,10 +1255,12 @@
         self._repo = repo
 
         usetreemanifest = False
+        cachesize = 4
 
         opts = getattr(opener, 'options', None)
         if opts is not None:
             usetreemanifest = opts.get('treemanifest', usetreemanifest)
+            cachesize = opts.get('manifestcachesize', cachesize)
         self._treeinmem = usetreemanifest
 
         self._oldmanifest = repo._constructmanifest()
@@ -1266,15 +1268,9 @@
 
         # A cache of the manifestctx or treemanifestctx for each directory
         self._dirmancache = {}
+        self._dirmancache[''] = util.lrucachedict(cachesize)
 
-        # We'll separate this into it's own cache once oldmanifest is no longer
-        # used
-        self._mancache = self._oldmanifest._mancache
-        self._dirmancache[''] = self._mancache
-
-        # A future patch makes this use the same config value as the existing
-        # mancache
-        self.cachesize = 4
+        self.cachesize = cachesize
 
     def __getitem__(self, node):
         """Retrieves the manifest instance for the given node. Throws a