diff mercurial/revlog.py @ 42746:05c80f9ef100

flagutil: move the `flagprocessors` mapping in the new module This module is meant to host most of the flag processing logic. We start with the mapping between flag and processors.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Aug 2019 01:04:48 +0200
parents ca5ca3badd3c
children 92ac6b1697a7
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Aug 08 01:03:01 2019 +0200
+++ b/mercurial/revlog.py	Thu Aug 08 01:04:48 2019 +0200
@@ -72,6 +72,7 @@
 )
 from .revlogutils import (
     deltas as deltautil,
+    flagutil,
 )
 from .utils import (
     interfaceutil,
@@ -110,11 +111,6 @@
 _maxinline = 131072
 _chunksize = 1048576
 
-# Store flag processors (cf. 'addflagprocessor()' to register)
-_flagprocessors = {
-    REVIDX_ISCENSORED: None,
-}
-
 # Flag processors for REVIDX_ELLIPSIS.
 def ellipsisreadprocessor(rl, text):
     return text, False
@@ -156,7 +152,7 @@
       debug commands. In this case the transform only indicates whether the
       contents can be used for hash integrity checks.
     """
-    _insertflagprocessor(flag, processor, _flagprocessors)
+    _insertflagprocessor(flag, processor, flagutil.flagprocessors)
 
 def _insertflagprocessor(flag, processor, flagprocessors):
     if not flag & REVIDX_KNOWN_FLAGS:
@@ -386,7 +382,7 @@
 
         # Make copy of flag processors so each revlog instance can support
         # custom flags.
-        self._flagprocessors = dict(_flagprocessors)
+        self._flagprocessors = dict(flagutil.flagprocessors)
 
         # 2-tuple of file handles being used for active writing.
         self._writinghandles = None