Patchwork [3,of,7] revlog: stop calling `basetext` `rawtext` in _revisiondata

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 20, 2019, 4:37 p.m.
Message ID <bab054f6cc691c74c503.1566319048@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/41369/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 20, 2019, 4:37 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1565214534 -7200
#      Wed Aug 07 23:48:54 2019 +0200
# Node ID bab054f6cc691c74c503e043ee82482695b403a4
# Parent  598ab124d9b67810662db9a5d770e90cf913b9a4
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r bab054f6cc69
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.
Yuya Nishihara - Aug. 21, 2019, 12:29 p.m.
On Tue, 20 Aug 2019 18:37:28 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1565214534 -7200
> #      Wed Aug 07 23:48:54 2019 +0200
> # Node ID bab054f6cc691c74c503e043ee82482695b403a4
> # Parent  598ab124d9b67810662db9a5d770e90cf913b9a4
> # EXP-Topic revisiondata
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r bab054f6cc69
> revlog: stop calling  `basetext` `rawtext` in _revisiondata

>              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 change to free memory early

s/change/chance/ in flight.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1621,6 +1621,7 @@  class revlog(object):
         cachedrev = None
         flags = None
         rawtext = None
+        basetext = None
         if node == nullid:
             return ""
         if self._revisioncache:
@@ -1648,7 +1649,7 @@  class revlog(object):
 
             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 @@  class revlog(object):
                 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 change to free memory early
             self._revisioncache = (node, rev, rawtext)
 
         if flags is None: