changeset 51856:384016e91947

revlog: simplify rawtext return value We're always returning a tuple even though only the raw text is being used, and we're rebuilding another tuple again higher. As a bonus, this will remove one tuple creation and deletion per `raw_text` call, hence fewer gc calls, etc.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 19 Jun 2024 17:19:20 +0200
parents eb9dea148233
children b04011ca6eff
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Jun 19 17:06:05 2024 +0200
+++ b/mercurial/revlog.py	Wed Jun 19 17:19:20 2024 +0200
@@ -1022,7 +1022,7 @@
     def raw_text(self, node, rev):
         """return the possibly unvalidated rawtext for a revision
 
-        returns (rev, rawtext, validated)
+        returns rawtext
         """
 
         # revision in the cache (could be useful to apply delta)
@@ -1063,7 +1063,7 @@
 
         rawtext = mdiff.patches(basetext, bins)
         del basetext  # let us have a chance to free memory early
-        return (rev, rawtext, False)
+        return rawtext
 
     def sidedata(self, rev, sidedata_end):
         """Return the sidedata for a given revision number."""
@@ -2761,7 +2761,8 @@
         if rev is None:
             rev = self.rev(node)
 
-        return self._inner.raw_text(node, rev)
+        text = self._inner.raw_text(node, rev)
+        return (rev, text, False)
 
     def _revisiondata(self, nodeorrev, raw=False):
         # deal with <nodeorrev> argument type