bundle2: add support for a 'stream' parameter to 'getbundle'
This parameter can be used to request a stream bundle.
--- a/mercurial/exchange.py Wed Jan 17 16:35:22 2018 +0100
+++ b/mercurial/exchange.py Wed Jan 17 16:36:23 2018 +0100
@@ -1747,6 +1747,19 @@
return bundler.getchunks()
+@getbundle2partsgenerator('stream')
+def _getbundlestream(bundler, repo, source, bundlecaps=None,
+ b2caps=None, heads=None, common=None, **kwargs):
+ if not kwargs.get('stream', False):
+ return
+ filecount, bytecount, it = streamclone.generatev2(repo)
+ requirements = ' '.join(repo.requirements)
+ part = bundler.newpart('stream', data=it)
+ part.addparam('bytecount', '%d' % bytecount, mandatory=True)
+ part.addparam('filecount', '%d' % filecount, mandatory=True)
+ part.addparam('requirements', requirements, mandatory=True)
+ part.addparam('version', 'v2', mandatory=True)
+
@getbundle2partsgenerator('changegroup')
def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
b2caps=None, heads=None, common=None, **kwargs):
--- a/mercurial/wireproto.py Wed Jan 17 16:35:22 2018 +0100
+++ b/mercurial/wireproto.py Wed Jan 17 16:36:23 2018 +0100
@@ -212,7 +212,9 @@
'bundlecaps': 'scsv',
'listkeys': 'csv',
'cg': 'boolean',
- 'cbattempted': 'boolean'}
+ 'cbattempted': 'boolean',
+ 'stream': 'boolean',
+}
# client side