Skip to content
Snippets Groups Projects
Commit 3bed541a authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

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
parent 519b4560
No related branches found
No related tags found
No related merge requests found
......@@ -154,5 +154,5 @@
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]
......@@ -158,5 +158,5 @@
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
......@@ -160,7 +160,7 @@
# 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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment