narrow: only send the narrowspecs back if ACL in play
authorPulkit Goyal <pulkit@yandex-team.ru>
Wed, 10 Oct 2018 17:36:59 +0300
changeset 40337 cb516a854bc7
parent 40336 d365e2b7aa2a
child 40338 af62936c2508
narrow: only send the narrowspecs back if ACL in play I am unable to think why we need to send narrowspecs back from the server. The current state adds a 'narrow:spec' part to each changegroup which is generated when narrow extension is enabled. So we are sending narrowspecs on pull also. There is a problem with sending the narrowspecs the way we are doing it right now. We add include and exclude as parameter of the 'narrow:spec' bundle2 part. The the len of include or exclude string increase 255 which is obvious while working on large repos, bundle2 generation code breaks. For more on that refer issue5952 on bugzilla. I was thinking why we need to send the narrowspecs back, and deleted the 'narrow:spec' bundle2 part generation code and found that only narrow-acl test has some failure. With this patch, we will only send the 'narrow:spec' bundle2 part if ACL is enabled because the original narrowspecs in those cases can be a subset of narrowspecs user requested. There are phase related output change in couple of tests. The output change shows that we are now dealing in public phases completely. So maybe sending the narrow:spec bundle2 part was preventing phases being exchanged or phase bundle2 data being applied. Differential Revision: https://phab.mercurial-scm.org/D4931
mercurial/exchange.py
tests/test-narrow-rebase.t
tests/test-narrow-widen-no-ellipsis.t
--- a/mercurial/exchange.py	Wed Oct 17 22:32:50 2018 +0800
+++ b/mercurial/exchange.py	Wed Oct 10 17:36:59 2018 +0300
@@ -1907,6 +1907,7 @@
     new_args = {}
     new_args.update(kwargs)
     new_args[r'narrow'] = True
+    new_args[r'narrow_acl'] = True
     new_args[r'includepats'] = req_includes
     if req_excludes:
         new_args[r'excludepats'] = req_excludes
@@ -2171,7 +2172,8 @@
     if 'treemanifest' in repo.requirements:
         part.addparam('treemanifest', '1')
 
-    if kwargs.get(r'narrow', False) and (include or exclude):
+    if (kwargs.get(r'narrow', False) and kwargs.get('narrow_acl', False)
+        and (include or exclude)):
         narrowspecpart = bundler.newpart('narrow:spec')
         if include:
             narrowspecpart.addparam(
--- a/tests/test-narrow-rebase.t	Wed Oct 17 22:32:50 2018 +0800
+++ b/tests/test-narrow-rebase.t	Wed Oct 10 17:36:59 2018 +0300
@@ -86,7 +86,6 @@
 
   $ hg update -q 'desc("conflicting outside/f1")'
   $ hg phase -f -d .
-  no phases changed
   $ hg rebase -d 'desc("modify outside/f1")'
   rebasing 4:707c035aadb6 "conflicting outside/f1"
   abort: conflict in file 'outside/f1' is outside narrow clone
--- a/tests/test-narrow-widen-no-ellipsis.t	Wed Oct 17 22:32:50 2018 +0800
+++ b/tests/test-narrow-widen-no-ellipsis.t	Wed Oct 10 17:36:59 2018 +0300
@@ -137,7 +137,6 @@
   adding file changes
   added 5 changesets with 4 changes to 2 files
   new changesets *:* (glob)
-  3 local changesets published
   (run 'hg update' to get a working copy)
   $ hg update -r 'desc("add wider")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved