Patchwork D6807: flagprocessors: small code update to clarify parameters

login
register
mail settings
Submitter phabricator
Date Sept. 7, 2019, 5:09 p.m.
Message ID <f88b08804ee4b558efa71abb7b3adc16@localhost.localdomain>
Download mbox | patch
Permalink /patch/41557/
State Not Applicable
Headers show

Comments

phabricator - Sept. 7, 2019, 5:09 p.m.
Closed by commit rHG3bed541aa65d: flagprocessors: small code update to clarify parameters (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6807?vs=16412&id=16446#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6807?vs=16412&id=16446

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6807/new/

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

AFFECTED FILES
  mercurial/revlogutils/flagutil.py

CHANGE DETAILS




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

Patch

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 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)