[PATCH 3 of 4] manifest: make uses of _mancache aware of contexts

Durham Goode durham at fb.com
Tue Aug 30 19:40:43 EDT 2016


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1472518929 25200
#      Mon Aug 29 18:02:09 2016 -0700
# Node ID 4b26b5cd815a717ee0ee930f4deef0959ef7c492
# Parent  22aaea9ec22e3dea58ad184476cc123c22c25b11
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.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -204,8 +204,8 @@ class bundlemanifest(bundlerevlog, manif
         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
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1128,7 +1128,11 @@ class manifest(manifestrevlog):
         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)


More information about the Mercurial-devel mailing list