changeset 42787:1ea668722c0d

revlog: assign rawtext earlier in `_revisiondata` Assigning the revision earlier make the code easier to read.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 07 Aug 2019 23:46:14 +0200
parents ef177c04ac7f
children 2eec53a99ec1
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon Aug 19 16:14:27 2019 +0200
+++ b/mercurial/revlog.py	Wed Aug 07 23:46:14 2019 +0200
@@ -1626,8 +1626,10 @@
         if self._revisioncache:
             if self._revisioncache[0] == node:
                 # _cache only stores rawtext
+                # rawtext is reusable. but we might need to run flag processors
+                rawtext = self._revisioncache[2]
                 if raw:
-                    return self._revisioncache[2]
+                    return rawtext
                 # duplicated, but good for perf
                 if rev is None:
                     rev = self.rev(node)
@@ -1635,9 +1637,7 @@
                     flags = self.flags(rev)
                 # no extra flags set, no flag processor runs, text = rawtext
                 if flags == REVIDX_DEFAULT_FLAGS:
-                    return self._revisioncache[2]
-                # rawtext is reusable. need to run flag processor
-                rawtext = self._revisioncache[2]
+                    return rawtext
 
             cachedrev = self._revisioncache[1]