revlog: assign rawtext earlier in `_revisiondata`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Aug 2019 23:46:14 +0200
changeset 42787 1ea668722c0d
parent 42786 ef177c04ac7f
child 42788 2eec53a99ec1
revlog: assign rawtext earlier in `_revisiondata` Assigning the revision earlier make the code easier to read.
mercurial/revlog.py
--- 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]