changeset 4984:b4066fcbd6ba

revlog: mark cache private
author Matt Mackall <mpm@selenic.com>
date Mon, 23 Jul 2007 20:44:08 -0500
parents 4dbcfc6e359e
children e6525e459157
files mercurial/bundlerepo.py mercurial/revlog.py
diffstat 2 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Mon Jul 23 20:44:08 2007 -0500
+++ b/mercurial/bundlerepo.py	Mon Jul 23 20:44:08 2007 -0500
@@ -104,8 +104,8 @@
         rev = self.rev(iter_node)
         # reconstruct the revision if it is from a changegroup
         while self.bundle(rev):
-            if self.cache and self.cache[0] == iter_node:
-                text = self.cache[2]
+            if self._cache and self._cache[0] == iter_node:
+                text = self._cache[2]
                 break
             chain.append(rev)
             iter_node = self.bundlebase(rev)
@@ -122,7 +122,7 @@
             raise revlog.RevlogError(_("integrity check failed on %s:%d")
                                      % (self.datafile, self.rev(node)))
 
-        self.cache = (node, self.rev(node), text)
+        self._cache = (node, self.rev(node), text)
         return text
 
     def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
--- a/mercurial/revlog.py	Mon Jul 23 20:44:08 2007 -0500
+++ b/mercurial/revlog.py	Mon Jul 23 20:44:08 2007 -0500
@@ -409,9 +409,8 @@
         self.indexfile = indexfile
         self.datafile = indexfile[:-2] + ".d"
         self.opener = opener
-
         self.indexstat = None
-        self.cache = None
+        self._cache = None
         self._chunkcache = None
         self.defversion = REVLOG_DEFAULT_VERSION
         if hasattr(opener, "defversion"):
@@ -891,8 +890,8 @@
         """return an uncompressed revision of a given"""
         if node == nullid:
             return ""
-        if self.cache and self.cache[0] == node:
-            return self.cache[2]
+        if self._cache and self._cache[0] == node:
+            return self._cache[2]
 
         # look up what we need to read
         text = None
@@ -906,9 +905,9 @@
             df = self.opener(self.datafile)
 
         # do we have useful data cached?
-        if self.cache and self.cache[1] >= base and self.cache[1] < rev:
-            base = self.cache[1]
-            text = self.cache[2]
+        if self._cache and self._cache[1] >= base and self._cache[1] < rev:
+            base = self._cache[1]
+            text = self._cache[2]
             self._loadindex(base, rev + 1)
         else:
             self._loadindex(base, rev + 1)
@@ -925,7 +924,7 @@
             raise RevlogError(_("integrity check failed on %s:%d")
                               % (self.datafile, rev))
 
-        self.cache = (node, rev, text)
+        self._cache = (node, rev, text)
         return text
 
     def checkinlinesize(self, tr, fp=None):
@@ -1047,7 +1046,7 @@
             ifh.write(data[1])
             self.checkinlinesize(transaction, ifh)
 
-        self.cache = (node, curr, text)
+        self._cache = (node, curr, text)
         return node
 
     def ancestor(self, a, b):
@@ -1233,7 +1232,7 @@
         indexf.truncate(end)
 
         # then reset internal state in memory to forget those revisions
-        self.cache = None
+        self._cache = None
         self._chunkcache = None
         for x in xrange(rev, self.count()):
             del self.nodemap[self.node(x)]