diff mercurial/revlogutils/flagutil.py @ 42730:92ac6b1697a7

flagutil: move REVIDX_KNOWN_FLAGS source of truth in flagutil (API) Since REVIDX_KNOWN_FLAGS is "not really a constant" (extension can update it) and python integer,... it needs to be the responsability of a single module and always accessed through the module. We update all the user and move the source of truth in flagutil.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Aug 2019 01:28:34 +0200
parents 05c80f9ef100
children 5109217a9ab6
line wrap: on
line diff
--- a/mercurial/revlogutils/flagutil.py	Thu Aug 08 01:04:48 2019 +0200
+++ b/mercurial/revlogutils/flagutil.py	Thu Aug 08 01:28:34 2019 +0200
@@ -14,10 +14,13 @@
     REVIDX_EXTSTORED,
     REVIDX_FLAGS_ORDER,
     REVIDX_ISCENSORED,
-    REVIDX_KNOWN_FLAGS,
     REVIDX_RAWTEXT_CHANGING_FLAGS,
 )
 
+from .. import (
+    util
+)
+
 # blanked usage of all the name to prevent pyflakes constraints
 # We need these name available in the module for extensions.
 REVIDX_ISCENSORED
@@ -25,9 +28,10 @@
 REVIDX_EXTSTORED
 REVIDX_DEFAULT_FLAGS
 REVIDX_FLAGS_ORDER
-REVIDX_KNOWN_FLAGS
 REVIDX_RAWTEXT_CHANGING_FLAGS
 
+REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER)
+
 # Store flag processors (cf. 'addflagprocessor()' to register)
 flagprocessors = {
     REVIDX_ISCENSORED: None,