mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
revlog: fix _cache usage in revision()
As documented at revlog.__init__, revlog._cache stores raw text. The current read and write usage of "_cache" in revlog.revision lacks of raw=True check. This patch fixes that by adding check about raw, and storing rawtext explicitly in _cache. Note: it may slow down cache hit code path when raw=False and flags=0. That performance issue will be fixed in a later patch. test-revlog-raw now points us to a new problem.
This commit is contained in:
parent
fec2bbc9e9
commit
50b232c61f
@ -1267,6 +1267,8 @@ class revlog(object):
|
||||
return ""
|
||||
if self._cache:
|
||||
if self._cache[0] == node:
|
||||
# _cache only stores rawtext
|
||||
if raw:
|
||||
return self._cache[2]
|
||||
cachedrev = self._cache[1]
|
||||
|
||||
@ -1294,7 +1296,7 @@ class revlog(object):
|
||||
if validatehash:
|
||||
self.checkhash(text, node, rev=rev)
|
||||
|
||||
self._cache = (node, rev, text)
|
||||
self._cache = (node, rev, rawtext)
|
||||
return text
|
||||
|
||||
def hash(self, text, p1, p2):
|
||||
|
@ -1 +1 @@
|
||||
abort: rev 5: wrong text
|
||||
abort: crashed: integrity check failed on _testrevlog.i:11
|
||||
|
Loading…
Reference in New Issue
Block a user