pulkit created this revision. Herald added a reviewer: durin42. Herald added a reviewer: martinvonz. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers.
REVISION SUMMARY This is a part of moving more narrow related bits to core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4888 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -2266,3 +2266,37 @@ repo.ui.debug('applying stream bundle\n') streamclone.applybundlev2(repo, part, filecount, bytecount, requirements) + +def widen_bundle(repo, diffmatcher, 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)' + 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 + ellipses is boolean value telling whether to send ellipses data or not + + returns bundle2 of the data required for extending + """ + bundler = bundle20(repo.ui) + commonnodes = set() + cl = repo.changelog + for r in repo.revs("::%ln", common): + commonnodes.add(cl.node(r)) + if commonnodes: + # XXX: we should only send the filelogs (and treemanifest). user + # already has the changelog and manifest + packer = changegroup.getbundler(cgversion, repo, + filematcher=diffmatcher, + fullnodes=commonnodes) + cgdata = packer.generate(set([nodemod.nullid]), list(commonnodes), + False, 'narrow_widen', changelog=False) + + part = bundler.newpart('changegroup', data=cgdata) + part.addparam('version', cgversion) + if 'treemanifest' in repo.requirements: + part.addparam('treemanifest', '1') + + return bundler diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -21,8 +21,6 @@ wireprotov1server, ) -from . import narrowbundle2 - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden @@ -95,7 +93,7 @@ exclude=oldexcludes) diffmatch = matchmod.differencematcher(newmatch, oldmatch) - bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + bundler = bundle2.widen_bundle(repo, diffmatch, common, known, cgversion, ellipses) except error.Abort as exc: bundler = bundle2.bundle20(repo.ui) diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -50,40 +50,6 @@ caps[NARROWCAP] = ['v0'] return caps -def widen_bundle(repo, diffmatcher, 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)' - 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 - ellipses is boolean value telling whether to send ellipses data or not - - returns bundle2 of the data required for extending - """ - bundler = bundle2.bundle20(repo.ui) - commonnodes = set() - cl = repo.changelog - for r in repo.revs("::%ln", common): - commonnodes.add(cl.node(r)) - if commonnodes: - # XXX: we should only send the filelogs (and treemanifest). user - # already has the changelog and manifest - packer = changegroup.getbundler(cgversion, repo, - filematcher=diffmatcher, - fullnodes=commonnodes) - cgdata = packer.generate(set([nullid]), list(commonnodes), False, - 'narrow_widen', changelog=False) - - part = bundler.newpart('changegroup', data=cgdata) - part.addparam('version', cgversion) - if 'treemanifest' in repo.requirements: - part.addparam('treemanifest', '1') - - return bundler - # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, To: pulkit, durin42, martinvonz, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel