changeset 29908:bb3281b3fcaa

manifest: make uses of _mancache aware of contexts In a future patch we will change manifestctx and treemanifestctx to no longer derive from manifestdict and treemanifest, respectively. This means that consumers of the _mancache will now need to be aware of the different between the two, until we get rid of the manifest entirely and the _mancache becomes only filled with ctxs.
author Durham Goode <durham@fb.com>
date Mon, 29 Aug 2016 18:02:09 -0700
parents 4fb4fc331699
children b60a5fe98b73
files mercurial/bundlerepo.py mercurial/manifest.py
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Wed Aug 31 13:29:49 2016 -0700
+++ b/mercurial/bundlerepo.py	Mon Aug 29 18:02:09 2016 -0700
@@ -204,8 +204,8 @@
         if isinstance(node, int):
             node = self.node(node)
 
-        if node in self._mancache:
-            result = self._mancache[node].text()
+        if node in self.fulltextcache:
+            result = self.fulltextcache[node].tostring()
         else:
             result = manifest.manifest.revision(self, nodeorrev)
         return result
--- a/mercurial/manifest.py	Wed Aug 31 13:29:49 2016 -0700
+++ b/mercurial/manifest.py	Mon Aug 29 18:02:09 2016 -0700
@@ -1130,7 +1130,11 @@
         if node == revlog.nullid:
             return self._newmanifest() # don't upset local cache
         if node in self._mancache:
-            return self._mancache[node]
+            cached = self._mancache[node]
+            if (isinstance(cached, manifestctx) or
+                isinstance(cached, treemanifestctx)):
+                cached = cached.read()
+            return cached
         if self._treeondisk:
             def gettext():
                 return self.revision(node)