--- a/mercurial/revlog.py Wed Aug 07 23:55:01 2019 +0200
+++ b/mercurial/revlog.py Mon Aug 19 16:29:43 2019 +0200
@@ -1633,11 +1633,14 @@
rawtext = None
# An intermediate text to apply deltas to
basetext = None
+ # Do we need to update the rawtext cache once it is validated ?
+ needcaching = True
# Check if we have the entry in cache
# The cache entry looks like (node, rev, rawtext)
if self._revisioncache:
if self._revisioncache[0] == node:
+ needcaching = False
# _cache only stores rawtext
# rawtext is reusable. but we might need to run flag processors
rawtext = self._revisioncache[2]
@@ -1680,7 +1683,6 @@
rawtext = mdiff.patches(basetext, bins)
del basetext # let us have a chance to free memory early
- self._revisioncache = (node, rev, rawtext)
if flags is None:
if rev is None:
@@ -1691,6 +1693,9 @@
if validatehash:
self.checkhash(text, node, rev=rev)
+ if needcaching:
+ self._revisioncache = (node, rev, rawtext)
+
return text
def rawdata(self, nodeorrev, _df=None):