revlog: stop calling `basetext` `rawtext` in _revisiondata
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Aug 2019 23:48:54 +0200
changeset 42788 2eec53a99ec1
parent 42787 1ea668722c0d
child 42789 bf070a59546a
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.
mercurial/revlog.py
--- 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: