manifest: make uses of _mancache aware of contexts
authorDurham Goode <durham@fb.com>
Mon, 29 Aug 2016 18:02:09 -0700
changeset 29908 bb3281b3fcaa
parent 29907 4fb4fc331699
child 29909 b60a5fe98b73
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.
mercurial/bundlerepo.py
mercurial/manifest.py
--- 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)