Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG247b473f408e: bundle2: **strkwargs love on various kwargs constructions
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/bundle2.py (8 lines) |
'in-reply-to')) | 'in-reply-to')) | ||||
def handleerrorpushkey(op, inpart): | def handleerrorpushkey(op, inpart): | ||||
"""Used to transmit failure of a mandatory pushkey over the wire""" | """Used to transmit failure of a mandatory pushkey over the wire""" | ||||
kwargs = {} | kwargs = {} | ||||
for name in ('namespace', 'key', 'new', 'old', 'ret'): | for name in ('namespace', 'key', 'new', 'old', 'ret'): | ||||
value = inpart.params.get(name) | value = inpart.params.get(name) | ||||
if value is not None: | if value is not None: | ||||
kwargs[name] = value | kwargs[name] = value | ||||
raise error.PushkeyFailed(inpart.params['in-reply-to'], **kwargs) | raise error.PushkeyFailed(inpart.params['in-reply-to'], | ||||
**pycompat.strkwargs(kwargs)) | |||||
@parthandler('error:unsupportedcontent', ('parttype', 'params')) | @parthandler('error:unsupportedcontent', ('parttype', 'params')) | ||||
def handleerrorunsupportedcontent(op, inpart): | def handleerrorunsupportedcontent(op, inpart): | ||||
"""Used to transmit unknown content error over the wire""" | """Used to transmit unknown content error over the wire""" | ||||
kwargs = {} | kwargs = {} | ||||
parttype = inpart.params.get('parttype') | parttype = inpart.params.get('parttype') | ||||
if parttype is not None: | if parttype is not None: | ||||
kwargs['parttype'] = parttype | kwargs['parttype'] = parttype | ||||
params = inpart.params.get('params') | params = inpart.params.get('params') | ||||
if params is not None: | if params is not None: | ||||
kwargs['params'] = params.split('\0') | kwargs['params'] = params.split('\0') | ||||
raise error.BundleUnknownFeatureError(**kwargs) | raise error.BundleUnknownFeatureError(**pycompat.strkwargs(kwargs)) | ||||
@parthandler('error:pushraced', ('message',)) | @parthandler('error:pushraced', ('message',)) | ||||
def handleerrorpushraced(op, inpart): | def handleerrorpushraced(op, inpart): | ||||
"""Used to transmit push race error over the wire""" | """Used to transmit push race error over the wire""" | ||||
raise error.ResponseError(_('push failed:'), inpart.params['message']) | raise error.ResponseError(_('push failed:'), inpart.params['message']) | ||||
@parthandler('listkeys', ('namespace',)) | @parthandler('listkeys', ('namespace',)) | ||||
def handlelistkeys(op, inpart): | def handlelistkeys(op, inpart): | ||||
rpart.addparam( | rpart.addparam( | ||||
'in-reply-to', pycompat.bytestr(inpart.id), mandatory=False) | 'in-reply-to', pycompat.bytestr(inpart.id), mandatory=False) | ||||
rpart.addparam('return', '%i' % ret, mandatory=False) | rpart.addparam('return', '%i' % ret, mandatory=False) | ||||
if inpart.mandatory and not ret: | if inpart.mandatory and not ret: | ||||
kwargs = {} | kwargs = {} | ||||
for key in ('namespace', 'key', 'new', 'old', 'ret'): | for key in ('namespace', 'key', 'new', 'old', 'ret'): | ||||
if key in inpart.params: | if key in inpart.params: | ||||
kwargs[key] = inpart.params[key] | kwargs[key] = inpart.params[key] | ||||
raise error.PushkeyFailed(partid=str(inpart.id), **kwargs) | raise error.PushkeyFailed(partid=str(inpart.id), | ||||
**pycompat.strkwargs(kwargs)) | |||||
@parthandler('bookmarks') | @parthandler('bookmarks') | ||||
def handlebookmark(op, inpart): | def handlebookmark(op, inpart): | ||||
"""transmit bookmark information | """transmit bookmark information | ||||
The part contains binary encoded bookmark information. | The part contains binary encoded bookmark information. | ||||
The exact behavior of this part can be controlled by the 'bookmarks' mode | The exact behavior of this part can be controlled by the 'bookmarks' mode |