Patchwork [3,of,5,v4] revlog: pass flags to addrevision

login
register
mail settings
Submitter via Mercurial-devel
Date Nov. 30, 2016, 5:55 a.m.
Message ID <CAESOdVCv6Bqb_ZNxAmPOhQ+ayha-1iS8+NhdnGAUwafcRD4f7g@mail.gmail.com>
Download mbox | patch
Permalink /patch/17797/
State Not Applicable
Headers show

Comments

via Mercurial-devel - Nov. 30, 2016, 5:55 a.m.
On Nov 23, 2016 10:39, "Remi Chaintron" <remi@fb.com> wrote:

# HG changeset patch
# User Remi Chaintron <remi@fb.com>
# Date 1479916365 0
#      Wed Nov 23 15:52:45 2016 +0000
# Branch stable
# Node ID da91f91e979d6bf807912e956cf2f29573ede56f
# Parent  eb24cc60a279d614b3181a84464200bbcf5f6bb4
revlog: pass flags to addrevision


I think narrowhg would be happy if the flags were passed all the way
through to checkhash(). We (some Googler) will probably send a patch the
does that later otherwise, but maybe you can squeeze it into this patch?


Add the ability to pass known revision flags to `revlog.addrevision`. This
allows to ensure present flags are propagated and usable by the extensions
relying on the flagprocessor, such as `lfs`.

         """
         if link == nullrev:
             raise RevlogError(_("attempted to add linkrev -1 to %s")
@@ -1432,7 +1433,7 @@
         ifh = self.opener(self.indexfile, "a+",
checkambig=self._checkambig)
         try:
             return self._addrevision(node, text, transaction, link, p1, p2,
-                                     REVIDX_DEFAULT_FLAGS, cachedelta,
ifh, dfh)
+                                     flags, cachedelta, ifh, dfh)
         finally:
             if dfh:
                 dfh.close()
Rémi Chaintron - Nov. 30, 2016, 11:18 a.m.
Looking at the code in narrowrevlog.py on bitbucket, it looks like a good
use case to use the new flag processor method to bypass checkhash. Would
you be interested in discussing this approach / what your needs are?



On Wed, 30 Nov 2016 at 05:55 Martin von Zweigbergk via Mercurial-devel <
mercurial-devel@mercurial-scm.org> wrote:

>
>
> On Nov 23, 2016 10:39, "Remi Chaintron" <remi@fb.com> wrote:
>
> # HG changeset patch
> # User Remi Chaintron <remi@fb.com>
> # Date 1479916365 0
> #      Wed Nov 23 15:52:45 2016 +0000
> # Branch stable
> # Node ID da91f91e979d6bf807912e956cf2f29573ede56f
> # Parent  eb24cc60a279d614b3181a84464200bbcf5f6bb4
> revlog: pass flags to addrevision
>
>
> I think narrowhg would be happy if the flags were passed all the way
> through to checkhash(). We (some Googler) will probably send a patch the
> does that later otherwise, but maybe you can squeeze it into this patch?
>
>
> Add the ability to pass known revision flags to `revlog.addrevision`. This
> allows to ensure present flags are propagated and usable by the extensions
> relying on the flagprocessor, such as `lfs`.
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1401,7 +1401,7 @@
>          self._chunkclear()
>
>      def addrevision(self, text, transaction, link, p1, p2,
> cachedelta=None,
> -                    node=None):
> +                    node=None, flags=REVIDX_DEFAULT_FLAGS):
>          """add a revision to the log
>
>          text - the revision data to add
> @@ -1412,6 +1412,7 @@
>          node - nodeid of revision; typically node is not specified, and
> it is
>              computed by default as hash(text, p1, p2), however subclasses
> might
>              use different hashing method (and override checkhash() in
> such case)
> +        flags - the known flags to set on the revision
>          """
>          if link == nullrev:
>              raise RevlogError(_("attempted to add linkrev -1 to %s")
> @@ -1432,7 +1433,7 @@
>          ifh = self.opener(self.indexfile, "a+",
> checkambig=self._checkambig)
>          try:
>              return self._addrevision(node, text, transaction, link, p1,
> p2,
> -                                     REVIDX_DEFAULT_FLAGS, cachedelta,
> ifh, dfh)
> +                                     flags, cachedelta, ifh, dfh)
>          finally:
>              if dfh:
>                  dfh.close()
> _______________________________________________
> 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
>
via Mercurial-devel - Nov. 30, 2016, 1:48 p.m.
On Nov 30, 2016 04:19, "Rémi Chaintron" <remi.chaintron@gmail.com> wrote:

Looking at the code in narrowrevlog.py on bitbucket, it looks like a good
use case to use the new flag processor method to bypass checkhash. Would
you be interested in discussing this approach / what your needs are?


Oh, you're right, we simply want to skip hash checking completely. I was
confusing it with what we do in an internal extension, where we want to do
different hash check. However, that's not based on a revlog flag, so
passing the flags won't help us. So we're happy with the current state of
your series, thanks :-)




On Wed, 30 Nov 2016 at 05:55 Martin von Zweigbergk via Mercurial-devel <
mercurial-devel@mercurial-scm.org> wrote:

>
>
> On Nov 23, 2016 10:39, "Remi Chaintron" <remi@fb.com> wrote:
>
> # HG changeset patch
> # User Remi Chaintron <remi@fb.com>
> # Date 1479916365 0
> #      Wed Nov 23 15:52:45 2016 +0000
> # Branch stable
> # Node ID da91f91e979d6bf807912e956cf2f29573ede56f
> # Parent  eb24cc60a279d614b3181a84464200bbcf5f6bb4
> revlog: pass flags to addrevision
>
>
> I think narrowhg would be happy if the flags were passed all the way
> through to checkhash(). We (some Googler) will probably send a patch the
> does that later otherwise, but maybe you can squeeze it into this patch?
>
>
> Add the ability to pass known revision flags to `revlog.addrevision`. This
> allows to ensure present flags are propagated and usable by the extensions
> relying on the flagprocessor, such as `lfs`.
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1401,7 +1401,7 @@
>          self._chunkclear()
>
>      def addrevision(self, text, transaction, link, p1, p2,
> cachedelta=None,
> -                    node=None):
> +                    node=None, flags=REVIDX_DEFAULT_FLAGS):
>          """add a revision to the log
>
>          text - the revision data to add
> @@ -1412,6 +1412,7 @@
>          node - nodeid of revision; typically node is not specified, and
> it is
>              computed by default as hash(text, p1, p2), however subclasses
> might
>              use different hashing method (and override checkhash() in
> such case)
> +        flags - the known flags to set on the revision
>          """
>          if link == nullrev:
>              raise RevlogError(_("attempted to add linkrev -1 to %s")
> @@ -1432,7 +1433,7 @@
>          ifh = self.opener(self.indexfile, "a+",
> checkambig=self._checkambig)
>          try:
>              return self._addrevision(node, text, transaction, link, p1,
> p2,
> -                                     REVIDX_DEFAULT_FLAGS, cachedelta,
> ifh, dfh)
> +                                     flags, cachedelta, ifh, dfh)
>          finally:
>              if dfh:
>                  dfh.close()
> _______________________________________________
> 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/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1401,7 +1401,7 @@ 
         self._chunkclear()

     def addrevision(self, text, transaction, link, p1, p2, cachedelta=None,
-                    node=None):
+                    node=None, flags=REVIDX_DEFAULT_FLAGS):
         """add a revision to the log

         text - the revision data to add
@@ -1412,6 +1412,7 @@ 
         node - nodeid of revision; typically node is not specified, and it
is
             computed by default as hash(text, p1, p2), however subclasses
might
             use different hashing method (and override checkhash() in such
case)
+        flags - the known flags to set on the revision