Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/flagutil.py @ 42993:eb5048f8c533
flagprocessors: make `processflagsread` a module level function
One more steps toward removing the mixin.
Differential Revision: https://phab.mercurial-scm.org/D6819
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 07 Sep 2019 00:11:58 +0200 |
parents | a04b2c010d03 |
children | dff95420480f |
line wrap: on
line diff
--- a/mercurial/revlogutils/flagutil.py Fri Sep 06 23:50:32 2019 +0200 +++ b/mercurial/revlogutils/flagutil.py Sat Sep 07 00:11:58 2019 +0200 @@ -96,30 +96,10 @@ if raw: return text, self._processflagsraw(text, flags) elif operation == 'read': - return self._processflagsread(text, flags) + return processflagsread(self, text, flags) else: # write operation return processflagswrite(self, text, flags) - def _processflagsread(self, text, flags): - """Inspect revision data flags and applies read transformations defined - by registered flag processors. - - ``text`` - the revision data to process - ``flags`` - the revision flags - ``raw`` - an optional argument describing if the raw transform should be - applied. - - This method processes the flags in the order (or reverse order if - ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the - flag processors registered for present flags. The order of flags defined - in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity. - - Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the - processed text and ``validatehash`` is a bool indicating whether the - returned text should be checked for hash integrity. - """ - return _processflagsfunc(self, text, flags, 'read') - def _processflagsraw(self, text, flags): """Inspect revision data flags to check is the content hash should be validated. @@ -157,6 +137,26 @@ return _processflagsfunc(revlog, text, flags, 'write', sidedata=sidedata)[:2] +def processflagsread(revlog, text, flags): + """Inspect revision data flags and applies read transformations defined + by registered flag processors. + + ``text`` - the revision data to process + ``flags`` - the revision flags + ``raw`` - an optional argument describing if the raw transform should be + applied. + + This method processes the flags in the order (or reverse order if + ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the + flag processors registered for present flags. The order of flags defined + in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity. + + Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the + processed text and ``validatehash`` is a bool indicating whether the + returned text should be checked for hash integrity. + """ + return _processflagsfunc(revlog, text, flags, 'read') + def _processflagsfunc(revlog, text, flags, operation, sidedata=None): """internal function to process flag on a revlog