##// END OF EJS Templates
revlog: rename _cache to _revisioncache...
Gregory Szorc -
r40088:55db747a default
parent child Browse files
Show More
@@ -127,8 +127,8 b' class bundlerevlog(revlog.revlog):'
127 iterrev = rev
127 iterrev = rev
128 # reconstruct the revision if it is from a changegroup
128 # reconstruct the revision if it is from a changegroup
129 while iterrev > self.repotiprev:
129 while iterrev > self.repotiprev:
130 if self._cache and self._cache[1] == iterrev:
130 if self._revisioncache and self._revisioncache[1] == iterrev:
131 rawtext = self._cache[2]
131 rawtext = self._revisioncache[2]
132 break
132 break
133 chain.append(iterrev)
133 chain.append(iterrev)
134 iterrev = self.index[iterrev][3]
134 iterrev = self.index[iterrev][3]
@@ -143,7 +143,7 b' class bundlerevlog(revlog.revlog):'
143 'read', raw=raw)
143 'read', raw=raw)
144 if validatehash:
144 if validatehash:
145 self.checkhash(text, node, rev=rev)
145 self.checkhash(text, node, rev=rev)
146 self._cache = (node, rev, rawtext)
146 self._revisioncache = (node, rev, rawtext)
147 return text
147 return text
148
148
149 def baserevision(self, nodeorrev):
149 def baserevision(self, nodeorrev):
@@ -346,7 +346,7 b' class revlog(object):'
346 self._checkambig = checkambig
346 self._checkambig = checkambig
347 self._censorable = censorable
347 self._censorable = censorable
348 # 3-tuple of (node, rev, text) for a raw revision.
348 # 3-tuple of (node, rev, text) for a raw revision.
349 self._cache = None
349 self._revisioncache = None
350 # Maps rev to chain base rev.
350 # Maps rev to chain base rev.
351 self._chainbasecache = util.lrucachedict(100)
351 self._chainbasecache = util.lrucachedict(100)
352 # 2-tuple of (offset, data) of raw data from the revlog at an offset.
352 # 2-tuple of (offset, data) of raw data from the revlog at an offset.
@@ -545,7 +545,7 b' class revlog(object):'
545 return True
545 return True
546
546
547 def clearcaches(self):
547 def clearcaches(self):
548 self._cache = None
548 self._revisioncache = None
549 self._chainbasecache.clear()
549 self._chainbasecache.clear()
550 self._chunkcache = (0, '')
550 self._chunkcache = (0, '')
551 self._pcache = {}
551 self._pcache = {}
@@ -1524,11 +1524,11 b' class revlog(object):'
1524 rawtext = None
1524 rawtext = None
1525 if node == nullid:
1525 if node == nullid:
1526 return ""
1526 return ""
1527 if self._cache:
1527 if self._revisioncache:
1528 if self._cache[0] == node:
1528 if self._revisioncache[0] == node:
1529 # _cache only stores rawtext
1529 # _cache only stores rawtext
1530 if raw:
1530 if raw:
1531 return self._cache[2]
1531 return self._revisioncache[2]
1532 # duplicated, but good for perf
1532 # duplicated, but good for perf
1533 if rev is None:
1533 if rev is None:
1534 rev = self.rev(node)
1534 rev = self.rev(node)
@@ -1536,11 +1536,11 b' class revlog(object):'
1536 flags = self.flags(rev)
1536 flags = self.flags(rev)
1537 # no extra flags set, no flag processor runs, text = rawtext
1537 # no extra flags set, no flag processor runs, text = rawtext
1538 if flags == REVIDX_DEFAULT_FLAGS:
1538 if flags == REVIDX_DEFAULT_FLAGS:
1539 return self._cache[2]
1539 return self._revisioncache[2]
1540 # rawtext is reusable. need to run flag processor
1540 # rawtext is reusable. need to run flag processor
1541 rawtext = self._cache[2]
1541 rawtext = self._revisioncache[2]
1542
1542
1543 cachedrev = self._cache[1]
1543 cachedrev = self._revisioncache[1]
1544
1544
1545 # look up what we need to read
1545 # look up what we need to read
1546 if rawtext is None:
1546 if rawtext is None:
@@ -1549,10 +1549,10 b' class revlog(object):'
1549
1549
1550 chain, stopped = self._deltachain(rev, stoprev=cachedrev)
1550 chain, stopped = self._deltachain(rev, stoprev=cachedrev)
1551 if stopped:
1551 if stopped:
1552 rawtext = self._cache[2]
1552 rawtext = self._revisioncache[2]
1553
1553
1554 # drop cache to save memory
1554 # drop cache to save memory
1555 self._cache = None
1555 self._revisioncache = None
1556
1556
1557 targetsize = None
1557 targetsize = None
1558 rawsize = self.index[rev][2]
1558 rawsize = self.index[rev][2]
@@ -1565,7 +1565,7 b' class revlog(object):'
1565 bins = bins[1:]
1565 bins = bins[1:]
1566
1566
1567 rawtext = mdiff.patches(rawtext, bins)
1567 rawtext = mdiff.patches(rawtext, bins)
1568 self._cache = (node, rev, rawtext)
1568 self._revisioncache = (node, rev, rawtext)
1569
1569
1570 if flags is None:
1570 if flags is None:
1571 if rev is None:
1571 if rev is None:
@@ -1926,7 +1926,7 b' class revlog(object):'
1926 rawtext = deltacomputer.buildtext(revinfo, fh)
1926 rawtext = deltacomputer.buildtext(revinfo, fh)
1927
1927
1928 if type(rawtext) == bytes: # only accept immutable objects
1928 if type(rawtext) == bytes: # only accept immutable objects
1929 self._cache = (node, curr, rawtext)
1929 self._revisioncache = (node, curr, rawtext)
1930 self._chainbasecache[curr] = deltainfo.chainbase
1930 self._chainbasecache[curr] = deltainfo.chainbase
1931 return node
1931 return node
1932
1932
@@ -2132,7 +2132,7 b' class revlog(object):'
2132 transaction.add(self.indexfile, end)
2132 transaction.add(self.indexfile, end)
2133
2133
2134 # then reset internal state in memory to forget those revisions
2134 # then reset internal state in memory to forget those revisions
2135 self._cache = None
2135 self._revisioncache = None
2136 self._chaininfocache = {}
2136 self._chaininfocache = {}
2137 self._chunkclear()
2137 self._chunkclear()
2138 for x in pycompat.xrange(rev, len(self)):
2138 for x in pycompat.xrange(rev, len(self)):
@@ -110,7 +110,7 b' class unionrevlog(revlog.revlog):'
110
110
111 if rev > self.repotiprev:
111 if rev > self.repotiprev:
112 text = self.revlog2.revision(node)
112 text = self.revlog2.revision(node)
113 self._cache = (node, rev, text)
113 self._revisioncache = (node, rev, text)
114 else:
114 else:
115 text = self.baserevision(rev)
115 text = self.baserevision(rev)
116 # already cached
116 # already cached
General Comments 0
You need to be logged in to leave comments. Login now