exchange: make narrow ACL presence imply narrow=True
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 28 Jul 2018 17:33:20 -0700
changeset 38847 98df52d5042c
parent 38846 5742d0428ed9
child 38848 d99083996398
exchange: make narrow ACL presence imply narrow=True And refactor the logic for determining when to invoke our custom changegroup part function so it is only conditional on narrow being set. This makes it more obvious under which conditions we should invoke the custom implementation. Also use raw strings so **kwargs works on Python 3. Differential Revision: https://phab.mercurial-scm.org/D4013
hgext/narrow/narrowbundle2.py
mercurial/exchange.py
--- a/hgext/narrow/narrowbundle2.py	Sat Jul 28 14:52:46 2018 -0700
+++ b/hgext/narrow/narrowbundle2.py	Sat Jul 28 17:33:20 2018 -0700
@@ -309,9 +309,9 @@
     def wrappedcgfn(*args, **kwargs):
         repo = args[1]
         if repo.ui.has_section(_NARROWACL_SECTION):
-            getbundlechangegrouppart_narrow(
-                *args, **exchange.applynarrowacl(repo, kwargs))
-        elif kwargs.get(r'narrow', False):
+            kwargs = exchange.applynarrowacl(repo, kwargs)
+
+        if kwargs.get(r'narrow', False):
             getbundlechangegrouppart_narrow(*args, **kwargs)
         else:
             origcgfn(*args, **kwargs)
--- a/mercurial/exchange.py	Sat Jul 28 14:52:46 2018 -0700
+++ b/mercurial/exchange.py	Sat Jul 28 17:33:20 2018 -0700
@@ -1872,9 +1872,11 @@
 
     new_args = {}
     new_args.update(kwargs)
-    new_args['includepats'] = req_includes
+    new_args[r'narrow'] = True
+    new_args[r'includepats'] = req_includes
     if req_excludes:
-        new_args['excludepats'] = req_excludes
+        new_args[r'excludepats'] = req_excludes
+
     return new_args
 
 def _computeellipsis(repo, common, heads, known, match, depth=None):