[PATCH 4 of 5 v4] revlog: REVIDX_ISLARGEFILE flag

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Nov 29 01:59:09 EST 2016



On 11/23/2016 06:39 PM, Remi Chaintron wrote:
> # HG changeset patch
> # User Remi Chaintron <remi at fb.com>
> # Date 1479922644 0
> #      Wed Nov 23 17:37:24 2016 +0000
> # Branch stable
> # Node ID 75ee4746c198f039a39400e855e9335afc34f1dd
> # Parent  da91f91e979d6bf807912e956cf2f29573ede56f
> revlog: REVIDX_ISLARGEFILE flag
>
> Add the REVIDX_ISLARGEFILE flag for the `lfs` extension to interact with
> revisions by registering transforms in the flagprocessor.

small naming question: Should we actually call this 'lfs'/'LARGEFILE'. 
Of courses. the extension using it is intended for large file. However, 
the core semantic of this 'flag' seems to be "the content is stored 
outsided of revlog". This external storage could be applied to any use 
cases (eg, fetching sensitive content from a secure server on update).

What do you think about adapting the name to reflect this?


> 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
> @@ -90,6 +90,7 @@
>  6-7 (2 bytes)
>     Bit flags impacting revision behavior. The following bit offsets define:
>     0: 'censor' extension flag.
> +   1: 'lfs' extension 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,11 +54,13 @@
>
>  # revlog index flags
>  REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified
> +REVIDX_ISLARGEFILE = (1 << 14)
>  REVIDX_DEFAULT_FLAGS = 0
> -REVIDX_KNOWN_FLAGS = REVIDX_ISCENSORED
> +REVIDX_KNOWN_FLAGS = REVIDX_ISCENSORED | REVIDX_ISLARGEFILE
>  # stable order in which flags need to be processed by the flagprocessor
>  REVIDX_FLAGS_PROCESSING_ORDER = [
>      REVIDX_ISCENSORED,
> +    REVIDX_ISLARGEFILE,
>  ]
>
>  # max size of revlog with inline data
> @@ -1773,6 +1775,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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list