comparison mercurial/wireproto.py @ 34739:b880cc11da5d

wireproto: bounce kwargs to/from bytes/str as needed Differential Revision: https://phab.mercurial-scm.org/D1107
author Augie Fackler <augie@google.com>
date Sun, 15 Oct 2017 00:05:43 -0400
parents 31fdd0509de9
children 60143d038eb7
comparison
equal deleted inserted replaced
34738:1c9128b735cd 34739:b880cc11da5d
311 311
312 def stream_out(self): 312 def stream_out(self):
313 return self._callstream('stream_out') 313 return self._callstream('stream_out')
314 314
315 def getbundle(self, source, **kwargs): 315 def getbundle(self, source, **kwargs):
316 kwargs = pycompat.byteskwargs(kwargs)
316 self.requirecap('getbundle', _('look up remote changes')) 317 self.requirecap('getbundle', _('look up remote changes'))
317 opts = {} 318 opts = {}
318 bundlecaps = kwargs.get('bundlecaps') 319 bundlecaps = kwargs.get('bundlecaps')
319 if bundlecaps is not None: 320 if bundlecaps is not None:
320 kwargs['bundlecaps'] = sorted(bundlecaps) 321 kwargs['bundlecaps'] = sorted(bundlecaps)
335 value = '%i' % bool(value) 336 value = '%i' % bool(value)
336 elif keytype != 'plain': 337 elif keytype != 'plain':
337 raise KeyError('unknown getbundle option type %s' 338 raise KeyError('unknown getbundle option type %s'
338 % keytype) 339 % keytype)
339 opts[key] = value 340 opts[key] = value
340 f = self._callcompressable("getbundle", **opts) 341 f = self._callcompressable("getbundle", **pycompat.strkwargs(opts))
341 if any((cap.startswith('HG2') for cap in bundlecaps)): 342 if any((cap.startswith('HG2') for cap in bundlecaps)):
342 return bundle2.getunbundler(self.ui, f) 343 return bundle2.getunbundler(self.ui, f)
343 else: 344 else:
344 return changegroupmod.cg1unpacker(f, 'UN') 345 return changegroupmod.cg1unpacker(f, 'UN')
345 346
442 chunk = rsp.read(1024) 443 chunk = rsp.read(1024)
443 work = [merged, chunk] 444 work = [merged, chunk]
444 yield unescapearg(''.join(work)) 445 yield unescapearg(''.join(work))
445 446
446 def _submitone(self, op, args): 447 def _submitone(self, op, args):
447 return self._call(op, **args) 448 return self._call(op, **pycompat.strkwargs(args))
448 449
449 def debugwireargs(self, one, two, three=None, four=None, five=None): 450 def debugwireargs(self, one, two, three=None, four=None, five=None):
450 # don't pass optional arguments left at their default value 451 # don't pass optional arguments left at their default value
451 opts = {} 452 opts = {}
452 if three is not None: 453 if three is not None: