[PATCH 3 of 4 v5] revlog: REVIDX_ISSTOREDEXTERNALLY flag

Remi Chaintron remi at fb.com
Wed Dec 14 06:58:09 EST 2016


# HG changeset patch
# User Remi Chaintron <remi at fb.com>
# Date 1481715180 0
#      Wed Dec 14 11:33:00 2016 +0000
# Branch stable
# Node ID 217f7db4dae3309bec78e27c85cc90e924b109be
# Parent  f4cd0db914fa6df17fdb733cdcf8b18ec79f8c0c
revlog: REVIDX_ISSTOREDEXTERNALLY flag

Add the REVIDX_ISSTOREDEXTERNALLY flag, for extensions to register transforms on
in REVIDX_FLAGS_TRANSFORMS. This will be used by the `lfs` extension to read
filelog data from the remote store.

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
@@ -88,7 +88,9 @@
 0-5 (6 bytes)
    Absolute offset of revision data from beginning of revlog.
 6-7 (2 bytes)
-   Bit flags impacting revision behavior.
+   Bit flags impacting revision behavior. The following bit offsets define:
+   0: 'censored' flag.
+   1: 'storedexternally' flag.
 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
@@ -54,15 +54,16 @@
 
 # revlog index flags
 REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified
+REVIDX_ISSTOREDEXTERNALLY = (1 << 14) # revision data is stored externally
 REVIDX_DEFAULT_FLAGS = 0
-REVIDX_KNOWN_FLAGS = REVIDX_ISCENSORED
+REVIDX_KNOWN_FLAGS = REVIDX_ISCENSORED | REVIDX_ISSTOREDEXTERNALLY
 # stable order in which flags need to be processed and their transforms applied
 REVIDX_FLAGS_ORDER = [
     REVIDX_ISCENSORED,
+    REVIDX_ISSTOREDEXTERNALLY,
 ]
 REVIDX_FLAGS_TRANSFORMS = { }
 
-
 # max size of revlog with inline data
 _maxinline = 131072
 _chunksize = 1048576
@@ -1716,6 +1717,10 @@
         """Check if a file revision is censored."""
         return False
 
+    def islargefile(self, rev):
+        """Check if a file revision is flagged as large."""
+        return self.flags(rev) & REVIDX_ISLARGEFILE
+
     def _peek_iscensored(self, baserev, delta, flush):
         """Quickly check if a delta produces a censored revision."""
         return False


More information about the Mercurial-devel mailing list