Mercurial > hg
diff hgext/narrow/narrowbundle2.py @ 38808:d99083996398
exchange: move simple narrow changegroup generation from extension
The narrow extension completely replaced the function generating the
changegroup part when a narrow changegroup was requested. Previous
commits have taught the in-core changegroup code how to filter files
based on a matcher. This commit teaches the in-core bundle2 part
generation code to construct a matcher based on arguments. It
will also emit a bundle2 part describing the narrow spec.
I believe the changegroup part generation code in the narrow extension
is now limited to ellipsis serving mode. i.e. core is now capable
of narrow changegroup generation when ellipsis mode is disabled.
Differential Revision: https://phab.mercurial-scm.org/D4014
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 28 Jul 2018 17:42:36 -0700 |
parents | 98df52d5042c |
children | a232e6744ba3 |
line wrap: on
line diff
--- a/hgext/narrow/narrowbundle2.py Sat Jul 28 17:33:20 2018 -0700 +++ b/hgext/narrow/narrowbundle2.py Sat Jul 28 17:42:36 2018 -0700 @@ -87,6 +87,8 @@ def getbundlechangegrouppart_narrow(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, common=None, **kwargs): + assert repo.ui.configbool('experimental', 'narrowservebrokenellipses') + cgversions = b2caps.get('changegroup') if cgversions: # 3.1 and 3.2 ship with an empty value cgversions = [v for v in cgversions @@ -101,28 +103,6 @@ include = sorted(filter(bool, kwargs.get(r'includepats', []))) exclude = sorted(filter(bool, kwargs.get(r'excludepats', []))) newmatch = narrowspec.match(repo.root, include=include, exclude=exclude) - if not repo.ui.configbool("experimental", "narrowservebrokenellipses"): - outgoing = exchange._computeoutgoing(repo, heads, common) - if not outgoing.missing: - return - - cg = changegroup.makestream(repo, outgoing, version, source, - filematcher=newmatch) - part = bundler.newpart('changegroup', data=cg) - part.addparam('version', version) - if 'treemanifest' in repo.requirements: - part.addparam('treemanifest', '1') - - if include or exclude: - narrowspecpart = bundler.newpart(_SPECPART) - if include: - narrowspecpart.addparam( - _SPECPART_INCLUDE, '\n'.join(include), mandatory=True) - if exclude: - narrowspecpart.addparam( - _SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) - - return depth = kwargs.get(r'depth', None) if depth is not None: @@ -311,7 +291,8 @@ if repo.ui.has_section(_NARROWACL_SECTION): kwargs = exchange.applynarrowacl(repo, kwargs) - if kwargs.get(r'narrow', False): + if (kwargs.get(r'narrow', False) and + repo.ui.configbool('experimental', 'narrowservebrokenellipses')): getbundlechangegrouppart_narrow(*args, **kwargs) else: origcgfn(*args, **kwargs)