Mercurial > hg
changeset 21622:457492741007
bundle2: support transmission of params error over the wire
We picked a null character to split each parameter during the transfer. This is
fragile if the same character is used in parameter name. However other
codes will already behave in a strange way in that case, so we are not
introducing any regression. A better format may be picked for the final
version of the protocol.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 28 May 2014 15:57:23 -0700 |
parents | b6eb56a9335d |
children | 5b26d82e4e2a |
files | mercurial/bundle2.py mercurial/wireproto.py |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Wed May 28 15:53:34 2014 -0700 +++ b/mercurial/bundle2.py Wed May 28 15:57:23 2014 -0700 @@ -831,8 +831,13 @@ @parthandler('b2x:error:unsupportedcontent') def handlereplycaps(op, inpart): """Used to transmit unknown content error over the wire""" - parttype = inpart.params['parttype'] - raise error.BundleValueError(parttype=parttype) + kwargs = {} + kwargs['parttype'] = inpart.params['parttype'] + params = inpart.params.get('params') + if params is not None: + kwargs['params'] = params.split('\0') + + raise error.BundleValueError(**kwargs) @parthandler('b2x:error:pushraced') def handlereplycaps(op, inpart):
--- a/mercurial/wireproto.py Wed May 28 15:53:34 2014 -0700 +++ b/mercurial/wireproto.py Wed May 28 15:57:23 2014 -0700 @@ -807,6 +807,8 @@ bundler = bundle2.bundle20(repo.ui) errpart = bundler.newpart('B2X:ERROR:UNSUPPORTEDCONTENT') errpart.addparam('parttype', exc.parttype) + if exc.params: + errpart.addparam('params', '\0'.join(exc.params)) return streamres(bundler.getchunks()) except util.Abort, inst: # The old code we moved used sys.stderr directly.