changeset 42788:2eec53a99ec1

revlog: stop calling `basetext` `rawtext` in _revisiondata If the cache entry is used as a base test for delta, it is not the rawtext we need. We update the variable name to clarify this.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 07 Aug 2019 23:48:54 +0200
parents 1ea668722c0d
children bf070a59546a
files mercurial/revlog.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Aug 07 23:46:14 2019 +0200
+++ b/mercurial/revlog.py	Wed Aug 07 23:48:54 2019 +0200
@@ -1621,6 +1621,7 @@
         cachedrev = None
         flags = None
         rawtext = None
+        basetext = None
         if node == nullid:
             return ""
         if self._revisioncache:
@@ -1648,7 +1649,7 @@
 
             chain, stopped = self._deltachain(rev, stoprev=cachedrev)
             if stopped:
-                rawtext = self._revisioncache[2]
+                basetext = self._revisioncache[2]
 
             # drop cache to save memory
             self._revisioncache = None
@@ -1659,11 +1660,12 @@
                 targetsize = 4 * rawsize
 
             bins = self._chunks(chain, df=_df, targetsize=targetsize)
-            if rawtext is None:
-                rawtext = bytes(bins[0])
+            if basetext is None:
+                basetext = bytes(bins[0])
                 bins = bins[1:]
 
-            rawtext = mdiff.patches(rawtext, bins)
+            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: