changeset 42882:3bed541aa65d

flagprocessors: small code update to clarify parameters 'raw' is really a third mode, not a small variant. Differential Revision: https://phab.mercurial-scm.org/D6807
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 07 Sep 2019 10:08:47 -0700
parents 519b45603880
children acf80f9edc85
files mercurial/revlogutils/flagutil.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/flagutil.py	Sat Sep 07 10:06:32 2019 -0700
+++ b/mercurial/revlogutils/flagutil.py	Sat Sep 07 10:08:47 2019 -0700
@@ -154,13 +154,13 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        return self._processflagsfunc(text, flags, 'read', raw=True)[1]
+        return self._processflagsfunc(text, flags, 'raw')[1]
 
-    def _processflagsfunc(self, text, flags, operation, raw=False):
+    def _processflagsfunc(self, text, flags, operation):
         # fast path: no flag processors will run
         if flags == 0:
             return text, True
-        if not operation in ('read', 'write'):
+        if operation not in ('read', 'write', 'raw'):
             raise error.ProgrammingError(_("invalid '%s' operation") %
                                          operation)
         # Check all flags are known.
@@ -188,7 +188,7 @@
                 if processor is not None:
                     readtransform, writetransform, rawtransform = processor
 
-                    if raw:
+                    if operation == 'raw':
                         vhash = rawtransform(self, text)
                     elif operation == 'read':
                         text, vhash = readtransform(self, text)