Patchwork [6,of,7,flagprocessor,v7] revlog: REVIDX_USR[0-3] flags

login
register
mail settings
Submitter Remi Chaintron
Date Jan. 2, 2017, 5:51 p.m.
Message ID <d4aaac74e17118d59373.1483379476@remi-mbp2>
Download mbox | patch
Permalink /patch/18073/
State Superseded
Delegated to: Pierre-Yves David
Headers show

Comments

Remi Chaintron - Jan. 2, 2017, 5:51 p.m.
# HG changeset patch
# User Remi Chaintron <remi@fb.com>
# Date 1483377423 18000
#      Mon Jan 02 12:17:03 2017 -0500
# Node ID d4aaac74e17118d59373b8380fcd98b7bb0419d8
# Parent  8a72e38f826c86f2a9ede795198a016c330734de
revlog: REVIDX_USR[0-3] flags

This patch introduces four flags for user extensions to register transforms on.
These flags will be used for extensions that do not belong to core, allowing
them to register flag transforms according to their behavior.
These flags will also be used to in the test-flagprocessor.t test in the
following patch.

Patch

diff --git a/mercurial/help/internals/revlogs.txt b/mercurial/help/internals/revlogs.txt
--- a/mercurial/help/internals/revlogs.txt
+++ b/mercurial/help/internals/revlogs.txt
@@ -91,6 +91,7 @@ 
    Bit flags impacting revision behavior. The following bit offsets define:
    0: REVIDX_ISCENSORED indicates the revision has censored metadata.
    1: REVIDX_EXTSTORED indicates the revision data is stored externally.
+   12-15: REVIDX_USR[0-3] user defined flags.
 8-11 (4 bytes)
    Compressed length of revision data / chunk as stored in revlog.
 12-15 (4 bytes)
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -55,12 +55,21 @@ 
 # revlog index flags
 REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified
 REVIDX_EXTSTORED = (1 << 14) # revision data is stored externally
+REVIDX_USR0 = (1 << 3)
+REVIDX_USR1 = (1 << 2)
+REVIDX_USR2 = (1 << 1)
+REVIDX_USR3 = 1
 REVIDX_DEFAULT_FLAGS = 0
 REVIDX_KNOWN_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED
+REVIDX_KNOWN_FLAGS |= REVIDX_USR0 | REVIDX_USR1 | REVIDX_USR2 | REVIDX_USR3
 # stable order in which flags need to be processed and their transforms applied
 REVIDX_FLAGS_ORDER = [
     REVIDX_ISCENSORED,
     REVIDX_EXTSTORED,
+    REVIDX_USR0,
+    REVIDX_USR1,
+    REVIDX_USR2,
+    REVIDX_USR3,
 ]
 
 # max size of revlog with inline data