bundle2: transmit capabilities to getbundle during pull
Bundle2 capabilities of the client are sent to the server in the bundlecaps
argument of `getbundle`.
--- a/mercurial/exchange.py Thu Apr 17 14:37:24 2014 -0400
+++ b/mercurial/exchange.py Thu Apr 17 02:01:38 2014 -0400
@@ -546,6 +546,8 @@
For now, the only supported data are changegroup."""
kwargs = {'bundlecaps': set(['HG20'])}
+ capsblob = bundle2.encodecaps(pullop.repo.bundle2caps)
+ kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob))
# pulling changegroup
pullop.todosteps.remove('changegroup')
if not pullop.fetch:
@@ -660,7 +662,12 @@
return cg
# very crude first implementation,
# the bundle API will change and the generation will be done lazily.
- bundler = bundle2.bundle20(repo.ui)
+ b2caps = {}
+ for bcaps in bundlecaps:
+ if bcaps.startswith('bundle2='):
+ blob = urllib.unquote(bcaps[len('bundle2='):])
+ b2caps.update(bundle2.decodecaps(blob))
+ bundler = bundle2.bundle20(repo.ui, b2caps)
part = bundle2.bundlepart('changegroup', data=cg.getchunks())
bundler.addpart(part)
return util.chunkbuffer(bundler.getchunks())