Patchwork [08,of,15] clone: allow bundle2's stream clone with 'server.disablefullbundle'

login
register
mail settings
Submitter Boris Feld
Date Jan. 19, 2018, 8:08 p.m.
Message ID <77a0634011b5bc89472a.1516392532@FB>
Download mbox | patch
Permalink /patch/26961/
State Deferred, archived
Headers show

Comments

Boris Feld - Jan. 19, 2018, 8:08 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1516203512 -3600
#      Wed Jan 17 16:38:32 2018 +0100
# Node ID 77a0634011b5bc89472a134c5ea2b5623f6ca273
# Parent  b11f4652647e791727e14c94a0ccb7c0282c5a29
# EXP-Topic b2-stream
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 77a0634011b5
clone: allow bundle2's stream clone with 'server.disablefullbundle'

The previous check was a bit too strict and would not recognize a get bundle
not requesting changegroup.
Augie Fackler - Jan. 19, 2018, 8:27 p.m.
On Fri, Jan 19, 2018 at 09:08:52PM +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1516203512 -3600
> #      Wed Jan 17 16:38:32 2018 +0100
> # Node ID 77a0634011b5bc89472a134c5ea2b5623f6ca273
> # Parent  b11f4652647e791727e14c94a0ccb7c0282c5a29
> # EXP-Topic b2-stream
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 77a0634011b5
> clone: allow bundle2's stream clone with 'server.disablefullbundle'

That is, prior to this patch server.disablefullbundle also banned
streaming clones even if streaming clones were enabled? Did I get that
right?

>
> The previous check was a bit too strict and would not recognize a get bundle
> not requesting changegroup.
>
> diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
> --- a/mercurial/wireproto.py
> +++ b/mercurial/wireproto.py
> @@ -855,10 +855,11 @@ def getbundle(repo, proto, others):
>          if repo.ui.configbool('server', 'disablefullbundle'):
>              # Check to see if this is a full clone.
>              clheads = set(repo.changelog.heads())
> +            changegroup = opts.get('cg', True)
>              heads = set(opts.get('heads', set()))
>              common = set(opts.get('common', set()))
>              common.discard(nullid)
> -            if not common and clheads == heads:
> +            if changegroup and not common and clheads == heads:
>                  raise error.Abort(
>                      _('server has pull-based clones disabled'),
>                      hint=_('remove --pull if specified or upgrade Mercurial'))
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Boris Feld - Jan. 19, 2018, 9:39 p.m.
On Fri, 2018-01-19 at 15:27 -0500, Augie Fackler wrote:
> On Fri, Jan 19, 2018 at 09:08:52PM +0100, Boris Feld wrote:
> > # HG changeset patch
> > # User Boris Feld <boris.feld@octobus.net>
> > # Date 1516203512 -3600
> > #      Wed Jan 17 16:38:32 2018 +0100
> > # Node ID 77a0634011b5bc89472a134c5ea2b5623f6ca273
> > # Parent  b11f4652647e791727e14c94a0ccb7c0282c5a29
> > # EXP-Topic b2-stream
> > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > #              hg pull https://bitbucket.org/octobus/mercurial-deve
> > l/ -r 77a0634011b5
> > clone: allow bundle2's stream clone with 'server.disablefullbundle'
> 
> That is, prior to this patch server.disablefullbundle also banned
> streaming clones even if streaming clones were enabled? Did I get
> that
> right?
> 

This is only affecting the v2 stream. v1 works fine without this patch.
V2 (via bundle2) needs this patch.

> > 
> > The previous check was a bit too strict and would not recognize a
> > get bundle
> > not requesting changegroup.
> > 
> > diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
> > --- a/mercurial/wireproto.py
> > +++ b/mercurial/wireproto.py
> > @@ -855,10 +855,11 @@ def getbundle(repo, proto, others):
> >          if repo.ui.configbool('server', 'disablefullbundle'):
> >              # Check to see if this is a full clone.
> >              clheads = set(repo.changelog.heads())
> > +            changegroup = opts.get('cg', True)
> >              heads = set(opts.get('heads', set()))
> >              common = set(opts.get('common', set()))
> >              common.discard(nullid)
> > -            if not common and clheads == heads:
> > +            if changegroup and not common and clheads == heads:
> >                  raise error.Abort(
> >                      _('server has pull-based clones disabled'),
> >                      hint=_('remove --pull if specified or upgrade
> > Mercurial'))
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -855,10 +855,11 @@  def getbundle(repo, proto, others):
         if repo.ui.configbool('server', 'disablefullbundle'):
             # Check to see if this is a full clone.
             clheads = set(repo.changelog.heads())
+            changegroup = opts.get('cg', True)
             heads = set(opts.get('heads', set()))
             common = set(opts.get('common', set()))
             common.discard(nullid)
-            if not common and clheads == heads:
+            if changegroup and not common and clheads == heads:
                 raise error.Abort(
                     _('server has pull-based clones disabled'),
                     hint=_('remove --pull if specified or upgrade Mercurial'))