##// END OF EJS Templates
revlog: mark cache private
Matt Mackall -
r4984:b4066fcb default
parent child Browse files
Show More
@@ -104,8 +104,8 b' class bundlerevlog(revlog.revlog):'
104 rev = self.rev(iter_node)
104 rev = self.rev(iter_node)
105 # reconstruct the revision if it is from a changegroup
105 # reconstruct the revision if it is from a changegroup
106 while self.bundle(rev):
106 while self.bundle(rev):
107 if self.cache and self.cache[0] == iter_node:
107 if self._cache and self._cache[0] == iter_node:
108 text = self.cache[2]
108 text = self._cache[2]
109 break
109 break
110 chain.append(rev)
110 chain.append(rev)
111 iter_node = self.bundlebase(rev)
111 iter_node = self.bundlebase(rev)
@@ -122,7 +122,7 b' class bundlerevlog(revlog.revlog):'
122 raise revlog.RevlogError(_("integrity check failed on %s:%d")
122 raise revlog.RevlogError(_("integrity check failed on %s:%d")
123 % (self.datafile, self.rev(node)))
123 % (self.datafile, self.rev(node)))
124
124
125 self.cache = (node, self.rev(node), text)
125 self._cache = (node, self.rev(node), text)
126 return text
126 return text
127
127
128 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
128 def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
@@ -409,9 +409,8 b' class revlog(object):'
409 self.indexfile = indexfile
409 self.indexfile = indexfile
410 self.datafile = indexfile[:-2] + ".d"
410 self.datafile = indexfile[:-2] + ".d"
411 self.opener = opener
411 self.opener = opener
412
413 self.indexstat = None
412 self.indexstat = None
414 self.cache = None
413 self._cache = None
415 self._chunkcache = None
414 self._chunkcache = None
416 self.defversion = REVLOG_DEFAULT_VERSION
415 self.defversion = REVLOG_DEFAULT_VERSION
417 if hasattr(opener, "defversion"):
416 if hasattr(opener, "defversion"):
@@ -891,8 +890,8 b' class revlog(object):'
891 """return an uncompressed revision of a given"""
890 """return an uncompressed revision of a given"""
892 if node == nullid:
891 if node == nullid:
893 return ""
892 return ""
894 if self.cache and self.cache[0] == node:
893 if self._cache and self._cache[0] == node:
895 return self.cache[2]
894 return self._cache[2]
896
895
897 # look up what we need to read
896 # look up what we need to read
898 text = None
897 text = None
@@ -906,9 +905,9 b' class revlog(object):'
906 df = self.opener(self.datafile)
905 df = self.opener(self.datafile)
907
906
908 # do we have useful data cached?
907 # do we have useful data cached?
909 if self.cache and self.cache[1] >= base and self.cache[1] < rev:
908 if self._cache and self._cache[1] >= base and self._cache[1] < rev:
910 base = self.cache[1]
909 base = self._cache[1]
911 text = self.cache[2]
910 text = self._cache[2]
912 self._loadindex(base, rev + 1)
911 self._loadindex(base, rev + 1)
913 else:
912 else:
914 self._loadindex(base, rev + 1)
913 self._loadindex(base, rev + 1)
@@ -925,7 +924,7 b' class revlog(object):'
925 raise RevlogError(_("integrity check failed on %s:%d")
924 raise RevlogError(_("integrity check failed on %s:%d")
926 % (self.datafile, rev))
925 % (self.datafile, rev))
927
926
928 self.cache = (node, rev, text)
927 self._cache = (node, rev, text)
929 return text
928 return text
930
929
931 def checkinlinesize(self, tr, fp=None):
930 def checkinlinesize(self, tr, fp=None):
@@ -1047,7 +1046,7 b' class revlog(object):'
1047 ifh.write(data[1])
1046 ifh.write(data[1])
1048 self.checkinlinesize(transaction, ifh)
1047 self.checkinlinesize(transaction, ifh)
1049
1048
1050 self.cache = (node, curr, text)
1049 self._cache = (node, curr, text)
1051 return node
1050 return node
1052
1051
1053 def ancestor(self, a, b):
1052 def ancestor(self, a, b):
@@ -1233,7 +1232,7 b' class revlog(object):'
1233 indexf.truncate(end)
1232 indexf.truncate(end)
1234
1233
1235 # then reset internal state in memory to forget those revisions
1234 # then reset internal state in memory to forget those revisions
1236 self.cache = None
1235 self._cache = None
1237 self._chunkcache = None
1236 self._chunkcache = None
1238 for x in xrange(rev, self.count()):
1237 for x in xrange(rev, self.count()):
1239 del self.nodemap[self.node(x)]
1238 del self.nodemap[self.node(x)]
General Comments 0
You need to be logged in to leave comments. Login now