Mercurial > hg
comparison mercurial/bundle2.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 | af62936c2508 |
children | 81c80ed7c991 |
comparison
equal
deleted
inserted
replaced
40343:a69d5823af6d | 40344:2c5835b4246b |
---|---|
2276 | 2276 |
2277 repo.ui.debug('applying stream bundle\n') | 2277 repo.ui.debug('applying stream bundle\n') |
2278 streamclone.applybundlev2(repo, part, filecount, bytecount, | 2278 streamclone.applybundlev2(repo, part, filecount, bytecount, |
2279 requirements) | 2279 requirements) |
2280 | 2280 |
2281 def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): | 2281 def widen_bundle(repo, oldmatcher, newmatcher, common, known, cgversion, |
2282 ellipses): | |
2282 """generates bundle2 for widening a narrow clone | 2283 """generates bundle2 for widening a narrow clone |
2283 | 2284 |
2284 repo is the localrepository instance | 2285 repo is the localrepository instance |
2285 diffmatcher is a differencemacther of '(newincludes, newexcludes) - | 2286 oldmatcher matches what the client already has |
2286 (oldincludes, oldexcludes)' | 2287 newmatcher matches what the client needs (including what it already has) |
2287 common is set of common heads between server and client | 2288 common is set of common heads between server and client |
2288 known is a set of revs known on the client side (used in ellipses) | 2289 known is a set of revs known on the client side (used in ellipses) |
2289 cgversion is the changegroup version to send | 2290 cgversion is the changegroup version to send |
2290 ellipses is boolean value telling whether to send ellipses data or not | 2291 ellipses is boolean value telling whether to send ellipses data or not |
2291 | 2292 |
2298 commonnodes.add(cl.node(r)) | 2299 commonnodes.add(cl.node(r)) |
2299 if commonnodes: | 2300 if commonnodes: |
2300 # XXX: we should only send the filelogs (and treemanifest). user | 2301 # XXX: we should only send the filelogs (and treemanifest). user |
2301 # already has the changelog and manifest | 2302 # already has the changelog and manifest |
2302 packer = changegroup.getbundler(cgversion, repo, | 2303 packer = changegroup.getbundler(cgversion, repo, |
2303 filematcher=diffmatcher, | 2304 oldmatcher=oldmatcher, |
2305 matcher=newmatcher, | |
2304 fullnodes=commonnodes) | 2306 fullnodes=commonnodes) |
2305 cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), | 2307 cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), |
2306 False, 'narrow_widen', changelog=False) | 2308 False, 'narrow_widen', changelog=False) |
2307 | 2309 |
2308 part = bundler.newpart('changegroup', data=cgdata) | 2310 part = bundler.newpart('changegroup', data=cgdata) |