Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Wed Oct 17 09:30:07 2018 -0700 +++ b/mercurial/bundle2.py Fri Oct 05 11:07:34 2018 -0700 @@ -2278,12 +2278,13 @@ streamclone.applybundlev2(repo, part, filecount, bytecount, requirements) -def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): +def widen_bundle(repo, oldmatcher, newmatcher, common, known, cgversion, + ellipses): """generates bundle2 for widening a narrow clone repo is the localrepository instance - diffmatcher is a differencemacther of '(newincludes, newexcludes) - - (oldincludes, oldexcludes)' + oldmatcher matches what the client already has + newmatcher matches what the client needs (including what it already has) common is set of common heads between server and client known is a set of revs known on the client side (used in ellipses) cgversion is the changegroup version to send @@ -2300,7 +2301,8 @@ # XXX: we should only send the filelogs (and treemanifest). user # already has the changelog and manifest packer = changegroup.getbundler(cgversion, repo, - filematcher=diffmatcher, + oldmatcher=oldmatcher, + matcher=newmatcher, fullnodes=commonnodes) cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), False, 'narrow_widen', changelog=False)