D6807: flagprocessors: small code update to clarify parameters

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Sat Sep 7 09:27:51 UTC 2019


marmoute created this revision.
marmoute added reviewers: yuja, durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  'raw' is really a third mode, not a small variant.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6807

AFFECTED FILES
  mercurial/revlogutils/flagutil.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -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 not operation 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)



To: marmoute, yuja, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list