Mercurial > hg
changeset 40071:e8132a8897da
narrow: start returning bundle2 from widen_bundle()
Differential Revision: https://phab.mercurial-scm.org/D4838
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Tue, 02 Oct 2018 17:09:56 +0300 |
parents | 8feae5b989bc |
children | 1ea80ac13f19 |
files | hgext/narrow/narrowbundle2.py hgext/narrow/narrowwirepeer.py |
diffstat | 2 files changed, 11 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/narrow/narrowbundle2.py Fri Sep 28 23:42:31 2018 +0300 +++ b/hgext/narrow/narrowbundle2.py Tue Oct 02 17:09:56 2018 +0300 @@ -51,7 +51,7 @@ return caps def widen_bundle(repo, diffmatcher, common, known, cgversion, ellipses): - """generates changegroup for widening a narrow clone + """generates bundle2 for widening a narrow clone repo is the localrepository instance diffmatcher is a differencemacther of '(newincludes, newexcludes) - @@ -61,11 +61,9 @@ cgversion is the changegroup version to send ellipses is boolean value telling whether to send ellipses data or not - returns changegroup data of the changegroup built or return None if there - are no common revs + returns bundle2 of the data required for extending """ - # XXX: This patch will start sending bundle2 after couple of patches when - # called from the wireprotocol command + bundler = bundle2.bundle20(repo.ui) commonnodes = set() cl = repo.changelog for r in repo.revs("::%ln", common): @@ -79,9 +77,12 @@ cgdata = packer.generate(set([nullid]), list(commonnodes), False, 'narrow_widen', changelog=False) - return cgdata + part = bundler.newpart('changegroup', data=cgdata) + part.addparam('version', cgversion) + if 'treemanifest' in repo.requirements: + part.addparam('treemanifest', '1') - return None + return bundler # Serve a changegroup for a client with a narrow clone. def getbundlechangegrouppart_narrow(bundler, repo, source,
--- a/hgext/narrow/narrowwirepeer.py Fri Sep 28 23:42:31 2018 +0300 +++ b/hgext/narrow/narrowwirepeer.py Tue Oct 02 17:09:56 2018 +0300 @@ -69,7 +69,6 @@ ellipses: whether to send ellipses data or not """ - bundler = bundle2.bundle20(repo.ui) try: oldincludes = wireprototypes.decodelist(oldincludes) newincludes = wireprototypes.decodelist(newincludes) @@ -96,15 +95,10 @@ exclude=oldexcludes) diffmatch = matchmod.differencematcher(newmatch, oldmatch) - # get changegroup data - cg = narrowbundle2.widen_bundle(repo, diffmatch, common, known, - cgversion, ellipses) - if cg is not None: - part = bundler.newpart('changegroup', data=cg) - part.addparam('version', cgversion) - if 'treemanifest' in repo.requirements: - part.addparam('treemanifest', '1') + bundler = narrowbundle2.widen_bundle(repo, diffmatch, common, known, + cgversion, ellipses) except error.Abort as exc: + bundler = bundle2.bundle20(repo.ui) manargs = [('message', pycompat.bytestr(exc))] advargs = [] if exc.hint is not None: