[PATCH 6 of 7 V3] revbranchcache: disable the new part for narrow hg bundle

Boris Feld boris.feld at octobus.net
Thu Mar 15 10:30:56 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1519237601 -3600
#      Wed Feb 21 19:26:41 2018 +0100
# Node ID de3ebe1992b795f0be17c922b1bc6c8c7373d06e
# Parent  e4e572bef19bde11ac42e68f3acaad02f83b0fbb
# EXP-Topic wire-rbc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r de3ebe1992b7
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(r'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):


More information about the Mercurial-devel mailing list