Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 40344:2c5835b4246b
narrow: when widening, don't include manifests the client already has
When widening, we already don't include the changelog (since
f1844a10ee19) and files that the client already has (since
c73c7653dfb9). However, we still include all manifests needed for the
new narrowspec. When using flat manifests, that means we resend all
the manifests even though the client necessarily has all of them. For
tree manifests, we unnecessarily resend the root manifests and any
subdirectory manifests that the client already has.
This patch makes it so we no longer resend manifests that the client
already has. It does so by passing an extra matcher to the changegroup
packer and it uses that for filtering out directories matching the old
matcher's visitdir(). For consistency between directories and files,
it also makes the filtering of files look at both old and new matcher
rather than passing in a diff matcher as we did before.
Differential Revision: https://phab.mercurial-scm.org/D4895
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 05 Oct 2018 11:07:34 -0700 |
parents | cb516a854bc7 |
children | dd816e5391f6 |
comparison
equal
deleted
inserted
replaced
40343:a69d5823af6d | 40344:2c5835b4246b |
---|---|
2151 return | 2151 return |
2152 | 2152 |
2153 if kwargs.get(r'narrow', False): | 2153 if kwargs.get(r'narrow', False): |
2154 include = sorted(filter(bool, kwargs.get(r'includepats', []))) | 2154 include = sorted(filter(bool, kwargs.get(r'includepats', []))) |
2155 exclude = sorted(filter(bool, kwargs.get(r'excludepats', []))) | 2155 exclude = sorted(filter(bool, kwargs.get(r'excludepats', []))) |
2156 filematcher = narrowspec.match(repo.root, include=include, | 2156 matcher = narrowspec.match(repo.root, include=include, exclude=exclude) |
2157 exclude=exclude) | |
2158 else: | 2157 else: |
2159 filematcher = None | 2158 matcher = None |
2160 | 2159 |
2161 cgstream = changegroup.makestream(repo, outgoing, version, source, | 2160 cgstream = changegroup.makestream(repo, outgoing, version, source, |
2162 bundlecaps=bundlecaps, | 2161 bundlecaps=bundlecaps, matcher=matcher) |
2163 filematcher=filematcher) | |
2164 | 2162 |
2165 part = bundler.newpart('changegroup', data=cgstream) | 2163 part = bundler.newpart('changegroup', data=cgstream) |
2166 if cgversions: | 2164 if cgversions: |
2167 part.addparam('version', version) | 2165 part.addparam('version', version) |
2168 | 2166 |