diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -769,6 +769,13 @@ class unbundlepart(unpackermixin): self.consumed = True return data +def bundle2caps(remote): + """return the bundlecapabilities of a peer as dict""" + raw = remote.capable('bundle2-exp') + if not raw and raw != '': + return {} + capsblob = urllib.unquote(remote.capable('bundle2-exp')) + return decodecaps(capsblob) @parthandler('b2x:changegroup') def handlechangegroup(op, inpart): diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -208,9 +208,7 @@ def _pushbundle2(pushop): The only currently supported type of data is changegroup but this will evolve in the future.""" - capsblob = urllib.unquote(pushop.remote.capable('bundle2-exp')) - caps = bundle2.decodecaps(capsblob) - bundler = bundle2.bundle20(pushop.ui, caps) + bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote)) # create reply capability capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) bundler.newpart('b2x:replycaps', data=capsblob)