Mercurial > hg
diff mercurial/bundle2.py @ 50706:0452af304808
stream-clone: add a v3 version of the protocol
This new version is less rigid regarding the extract number of files and number
of bytes to be actually transfered, it also lays the groundwork for other
improvements.
The format stays experimental, but this is an interesting base to build upon.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Thu, 01 Jun 2023 17:39:22 +0100 |
parents | 7200a9d4ea04 |
children | 0e936b950731 704c3d0878d9 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Thu Jun 01 18:20:28 2023 +0100 +++ b/mercurial/bundle2.py Thu Jun 01 17:39:22 2023 +0100 @@ -1952,14 +1952,12 @@ part.addparam(b'filecount', b'%d' % filecount, mandatory=True) part.addparam(b'requirements', requirements, mandatory=True) elif version == b"v3-exp": - filecount, bytecount, it = streamclone.generatev2( + it = streamclone.generatev3( repo, includepats, excludepats, includeobsmarkers ) requirements = streamclone.streamed_requirements(repo) requirements = _formatrequirementsspec(requirements) part = bundler.newpart(b'stream3-exp', data=it) - part.addparam(b'bytecount', b'%d' % bytecount, mandatory=True) - part.addparam(b'filecount', b'%d' % filecount, mandatory=True) part.addparam(b'requirements', requirements, mandatory=True) @@ -2616,9 +2614,18 @@ streamclone.applybundlev2(repo, part, filecount, bytecount, requirements) -@parthandler(b'stream3-exp', (b'requirements', b'filecount', b'bytecount')) +@parthandler(b'stream3-exp', (b'requirements',)) def handlestreamv3bundle(op, part): - return handlestreamv2bundle(op, part) + requirements = urlreq.unquote(part.params[b'requirements']) + requirements = requirements.split(b',') if requirements else [] + + repo = op.repo + if len(repo): + msg = _(b'cannot apply stream clone to non empty repository') + raise error.Abort(msg) + + repo.ui.debug(b'applying stream bundle\n') + streamclone.applybundlev3(repo, part, requirements) def widen_bundle(