[PATCH 06 of 14 V3] bundle2: add support for a 'stream' parameter to 'getbundle'
Boris Feld
boris.feld at octobus.net
Fri Jan 19 18:47:11 EST 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1516203383 -3600
# Wed Jan 17 16:36:23 2018 +0100
# Node ID 752abe0317e37feb6d837b2b17e0d63fa10fd63d
# Parent b9cc543a1208750e10125905dd09af32854ee285
# EXP-Topic b2-stream
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 752abe0317e3
bundle2: add support for a 'stream' parameter to 'getbundle'
This parameter can be used to request a stream bundle.
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1747,6 +1747,19 @@ def getbundlechunks(repo, source, heads=
return bundler.getchunks()
+ at 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):
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -212,7 +212,9 @@ gboptsmap = {'heads': 'nodes',
'bundlecaps': 'scsv',
'listkeys': 'csv',
'cg': 'boolean',
- 'cbattempted': 'boolean'}
+ 'cbattempted': 'boolean',
+ 'stream': 'boolean',
+}
# client side
More information about the Mercurial-devel
mailing list