Patchwork [6,of,7,V2] revbranchcache: disable the new part for narrow hg bundle

login
register
mail settings
Submitter Boris Feld
Date March 1, 2018, 8:44 p.m.
Message ID <2811d9ca31137ca7a9cc.1519937061@FB>
Download mbox | patch
Permalink /patch/28590/
State Superseded
Headers show

Comments

Boris Feld - March 1, 2018, 8:44 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1519237601 -3600
#      Wed Feb 21 19:26:41 2018 +0100
# Node ID 2811d9ca31137ca7a9cc7c8a37862cdbff87bbec
# Parent  56f869a852230bdbcff6ae3c366cb0d83f6cf757
# EXP-Topic wire-rbc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 2811d9ca3113
revbranchcache: disable the new part for narrow hg bundle

The lack of some revisions confuses the new cache part. To simplify things, we
disable it for now.
Yuya Nishihara - March 3, 2018, 12:22 a.m.
On Thu, 01 Mar 2018 15:44:21 -0500, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1519237601 -3600
> #      Wed Feb 21 19:26:41 2018 +0100
> # Node ID 2811d9ca31137ca7a9cc7c8a37862cdbff87bbec
> # Parent  56f869a852230bdbcff6ae3c366cb0d83f6cf757
> # EXP-Topic wire-rbc
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 2811d9ca3113
> revbranchcache: disable the new part for narrow hg bundle
> 
> The lack of some revisions confuses the new cache part. To simplify things, we
> disable it for now.
> 
> diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
> --- a/hgext/narrow/narrowbundle2.py
> +++ b/hgext/narrow/narrowbundle2.py
> @@ -479,6 +479,19 @@ def setup():
>              origcgfn(*args, **kwargs)
>      exchange.getbundle2partsmapping['changegroup'] = wrappedcgfn
>  
> +    # disable rev branch cache exchange when serving a narrow bundle
> +    # (currently incompatible with that part)
> +    origrbcfn = exchange.getbundle2partsmapping['cache:rev-branch-cache']
> +    def wrappedcgfn(*args, **kwargs):
> +        repo = args[1]
> +        if repo.ui.has_section(_NARROWACL_SECTION):
> +            return
> +        elif kwargs.get('narrow', False):
                           ^^^^^^^^
                           r''

Patch

diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -479,6 +479,19 @@  def setup():
             origcgfn(*args, **kwargs)
     exchange.getbundle2partsmapping['changegroup'] = wrappedcgfn
 
+    # disable rev branch cache exchange when serving a narrow bundle
+    # (currently incompatible with that part)
+    origrbcfn = exchange.getbundle2partsmapping['cache:rev-branch-cache']
+    def wrappedcgfn(*args, **kwargs):
+        repo = args[1]
+        if repo.ui.has_section(_NARROWACL_SECTION):
+            return
+        elif kwargs.get('narrow', False):
+            return
+        else:
+            origrbcfn(*args, **kwargs)
+    exchange.getbundle2partsmapping['cache:rev-branch-cache'] = wrappedcgfn
+
     # Extend changegroup receiver so client can fixup after widen requests.
     origcghandler = bundle2.parthandlermapping['changegroup']
     def wrappedcghandler(op, inpart):