Patchwork [3,of,4,v5] revlog: REVIDX_ISSTOREDEXTERNALLY flag

login
register
mail settings
Submitter Remi Chaintron
Date Dec. 14, 2016, 11:58 a.m.
Message ID <217f7db4dae3309bec78.1481716689@remi-mbp2>
Download mbox | patch
Permalink /patch/17903/
State Accepted
Headers show

Comments

Remi Chaintron - Dec. 14, 2016, 11:58 a.m.
# HG changeset patch
# User Remi Chaintron <remi@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.
Augie Fackler - Dec. 16, 2016, 8:47 p.m.
On Wed, Dec 14, 2016 at 11:58:09AM +0000, Remi Chaintron wrote:
> # HG changeset patch
> # User Remi Chaintron <remi@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

NameError: 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
RĂ©mi Chaintron - Dec. 16, 2016, 10:08 p.m.
My bad, this is an artifact from merging on some other work and isn't used
in any capacity in the current design.
Notes for removal!
On Fri, 16 Dec 2016 at 20:47, Augie Fackler <raf@durin42.com> wrote:

> On Wed, Dec 14, 2016 at 11:58:09AM +0000, Remi Chaintron wrote:
> > # HG changeset patch
> > # User Remi Chaintron <remi@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
>
> NameError: 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

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
@@ -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