diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1660,7 +1660,7 @@ sidedata = {} if raw: - validatehash = self._processflagsraw(rawtext, flags) + validatehash = flagutil.processflagsraw(self, rawtext, flags) text = rawtext else: r = flagutil.processflagsread(self, rawtext, flags) diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py +++ b/mercurial/revlogutils/deltas.py @@ -33,6 +33,10 @@ util, ) +from . import ( + flagutil, +) + # maximum / ratio LIMIT_DELTA2TEXT = 2 @@ -521,7 +525,7 @@ fulltext = mdiff.patch(basetext, delta) try: - validatehash = revlog._processflagsraw(fulltext, flags) + validatehash = flagutil.processflagsraw(revlog, fulltext, flags) if validatehash: revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2) if flags & REVIDX_ISCENSORED: diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py --- a/mercurial/revlogutils/flagutil.py +++ b/mercurial/revlogutils/flagutil.py @@ -94,30 +94,12 @@ msg = ('_processflag(...) use the specialized variant') util.nouideprecwarn(msg, '5.2', stacklevel=2) if raw: - return text, self._processflagsraw(text, flags) + return text, processflagsraw(self, text, flags) elif operation == 'read': return processflagsread(self, text, flags) else: # write operation return processflagswrite(self, text, flags) - def _processflagsraw(self, text, flags): - """Inspect revision data flags to check is the content hash should be - validated. - - ``text`` - the revision data to process - ``flags`` - the revision flags - - 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, 'raw')[1] - def processflagswrite(revlog, text, flags, sidedata): """Inspect revision data flags and applies write transformations defined by registered flag processors. @@ -157,6 +139,24 @@ """ return _processflagsfunc(revlog, text, flags, 'read') +def processflagsraw(revlog, text, flags): + """Inspect revision data flags to check is the content hash should be + validated. + + ``text`` - the revision data to process + ``flags`` - the revision flags + + 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, 'raw')[1] + def _processflagsfunc(revlog, text, flags, operation, sidedata=None): """internal function to process flag on a revlog diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -291,7 +291,7 @@ rawtext = self._svfs.read(path) if raw: - validatehash = self._processflagsraw(rawtext, flags) + validatehash = flagutil.processflagsraw(self, rawtext, flags) text = rawtext else: r = flagutil.processflagsread(self, rawtext, flags)