diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -7,7 +7,7 @@ from i18n import _ from node import hex, nullid -import errno +import errno, urllib import util, scmutil, changegroup, base85 import discovery, phases, obsolete, bookmarks, bundle2 @@ -207,7 +207,9 @@ def _pushbundle2(pushop): The only currently supported type of data is changegroup but this will evolve in the future.""" # Send known head to the server for race detection. - bundler = bundle2.bundle20(pushop.ui) + capsblob = urllib.unquote(pushop.remote.capable('bundle2')) + caps = bundle2.decodecaps(capsblob) + bundler = bundle2.bundle20(pushop.ui, caps) bundler.addpart(bundle2.bundlepart('replycaps')) if not pushop.force: part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads)) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -6,6 +6,7 @@ # GNU General Public License version 2 or any later version. from node import hex, nullid, short from i18n import _ +import urllib import peer, changegroup, subrepo, pushkey, obsolete, repoview import changelog, dirstate, filelog, manifest, context, bookmarks, phases import lock as lockmod @@ -63,7 +64,7 @@ def unfilteredmethod(orig): return wrapper moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle', - 'bundle2', 'unbundle')) + 'unbundle')) legacycaps = moderncaps.union(set(['changegroupsubset'])) class localpeer(peer.peerrepository): @@ -304,9 +305,10 @@ class localrepository(object): def _restrictcapabilities(self, caps): # bundle2 is not ready for prime time, drop it unless explicitly # required by the tests (or some brave tester) - if not self.ui.configbool('server', 'bundle2', False): + if self.ui.configbool('server', 'bundle2', False): caps = set(caps) - caps.discard('bundle2') + capsblob = bundle2.encodecaps(self.bundle2caps) + caps.add('bundle2=' + urllib.quote(capsblob)) return caps def _applyrequirements(self, requirements): diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -586,7 +586,8 @@ def _capabilities(repo, proto): else: caps.append('streamreqs=%s' % ','.join(requiredformats)) if repo.ui.configbool('server', 'bundle2', False): - caps.append('bundle2') + capsblob = bundle2.encodecaps(repo.bundle2caps) + caps.append('bundle2=' + urllib.quote(capsblob)) caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) caps.append('httpheader=1024') return caps