# HG changeset patch # User Pierre-Yves David # Date 1397714498 14400 # Node ID 5bb5d4ba14e55c32a42f6e9151b3a364cd7d0acc # Parent 15039ce3e4a39c85d30113b12dc44f5907d62450 bundle2: transmit capabilities to getbundle during pull Bundle2 capabilities of the client are sent to the server in the bundlecaps argument of `getbundle`. diff -r 15039ce3e4a3 -r 5bb5d4ba14e5 mercurial/exchange.py --- 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())