Patchwork [4,of,5,lfs-v2] revlog: REVIDX_ISLARGEFILE flag

login
register
mail settings
Submitter Remi Chaintron
Date Nov. 22, 2016, 5:56 p.m.
Message ID <02ae3995e54d3e38e059.1479837407@iphonesleepsort.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/17709/
State Superseded
Headers show

Comments

Remi Chaintron - Nov. 22, 2016, 5:56 p.m.
# HG changeset patch
# User Remi Chaintron <remi@fb.com>
# Date 1479829452 0
#      Tue Nov 22 15:44:12 2016 +0000
# Branch stable
# Node ID 02ae3995e54d3e38e059224f4e56b998735b5be2
# Parent  66391d01bb92ff5f1d14033c00389214f78f25cc
revlog: REVIDX_ISLARGEFILE flag

Add the REVIDX_ISLARGEFILE flag for the `lfs` extension to interact with
revisions by registering transforms in the flagprocessor.
Gregory Szorc - Nov. 22, 2016, 7:48 p.m.
On Tue, Nov 22, 2016 at 9:56 AM, Remi Chaintron <remi@fb.com> wrote:

> # HG changeset patch
> # User Remi Chaintron <remi@fb.com>
> # Date 1479829452 0
> #      Tue Nov 22 15:44:12 2016 +0000
> # Branch stable
> # Node ID 02ae3995e54d3e38e059224f4e56b998735b5be2
> # Parent  66391d01bb92ff5f1d14033c00389214f78f25cc
> revlog: REVIDX_ISLARGEFILE flag
>
> Add the REVIDX_ISLARGEFILE flag for the `lfs` extension to interact with
> revisions by registering transforms in the flagprocessor.
>
> 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)
>

This needs documented in mercurial/help/internals/revlogs.txt.

(I haven't looked at the rest of the series in much detail.)


>  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@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

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