Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHGb880cc11da5d: wireproto: bounce kwargs to/from bytes/str as needed
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| yuja |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| for l in output.splitlines(True): | for l in output.splitlines(True): | ||||
| self.ui.status(_('remote: '), l) | self.ui.status(_('remote: '), l) | ||||
| yield d | yield d | ||||
| def stream_out(self): | def stream_out(self): | ||||
| return self._callstream('stream_out') | return self._callstream('stream_out') | ||||
| def getbundle(self, source, **kwargs): | def getbundle(self, source, **kwargs): | ||||
| kwargs = pycompat.byteskwargs(kwargs) | |||||
| self.requirecap('getbundle', _('look up remote changes')) | self.requirecap('getbundle', _('look up remote changes')) | ||||
| opts = {} | opts = {} | ||||
| bundlecaps = kwargs.get('bundlecaps') | bundlecaps = kwargs.get('bundlecaps') | ||||
| if bundlecaps is not None: | if bundlecaps is not None: | ||||
| kwargs['bundlecaps'] = sorted(bundlecaps) | kwargs['bundlecaps'] = sorted(bundlecaps) | ||||
| else: | else: | ||||
| bundlecaps = () # kwargs could have it to None | bundlecaps = () # kwargs could have it to None | ||||
| for key, value in kwargs.iteritems(): | for key, value in kwargs.iteritems(): | ||||
| if value is None: | if value is None: | ||||
| continue | continue | ||||
| keytype = gboptsmap.get(key) | keytype = gboptsmap.get(key) | ||||
| if keytype is None: | if keytype is None: | ||||
| raise error.ProgrammingError( | raise error.ProgrammingError( | ||||
| 'Unexpectedly None keytype for key %s' % key) | 'Unexpectedly None keytype for key %s' % key) | ||||
| elif keytype == 'nodes': | elif keytype == 'nodes': | ||||
| value = encodelist(value) | value = encodelist(value) | ||||
| elif keytype in ('csv', 'scsv'): | elif keytype in ('csv', 'scsv'): | ||||
| value = ','.join(value) | value = ','.join(value) | ||||
| elif keytype == 'boolean': | elif keytype == 'boolean': | ||||
| value = '%i' % bool(value) | value = '%i' % bool(value) | ||||
| elif keytype != 'plain': | elif keytype != 'plain': | ||||
| raise KeyError('unknown getbundle option type %s' | raise KeyError('unknown getbundle option type %s' | ||||
| % keytype) | % keytype) | ||||
| opts[key] = value | opts[key] = value | ||||
| f = self._callcompressable("getbundle", **opts) | f = self._callcompressable("getbundle", **pycompat.strkwargs(opts)) | ||||
| if any((cap.startswith('HG2') for cap in bundlecaps)): | if any((cap.startswith('HG2') for cap in bundlecaps)): | ||||
| return bundle2.getunbundler(self.ui, f) | return bundle2.getunbundler(self.ui, f) | ||||
| else: | else: | ||||
| return changegroupmod.cg1unpacker(f, 'UN') | return changegroupmod.cg1unpacker(f, 'UN') | ||||
| def unbundle(self, cg, heads, url): | def unbundle(self, cg, heads, url): | ||||
| '''Send cg (a readable file-like object representing the | '''Send cg (a readable file-like object representing the | ||||
| changegroup to push, typically a chunkbuffer object) to the | changegroup to push, typically a chunkbuffer object) to the | ||||
| while ';' in merged: | while ';' in merged: | ||||
| one, merged = merged.split(';', 1) | one, merged = merged.split(';', 1) | ||||
| yield unescapearg(one) | yield unescapearg(one) | ||||
| chunk = rsp.read(1024) | chunk = rsp.read(1024) | ||||
| work = [merged, chunk] | work = [merged, chunk] | ||||
| yield unescapearg(''.join(work)) | yield unescapearg(''.join(work)) | ||||
| def _submitone(self, op, args): | def _submitone(self, op, args): | ||||
| return self._call(op, **args) | return self._call(op, **pycompat.strkwargs(args)) | ||||
| def debugwireargs(self, one, two, three=None, four=None, five=None): | def debugwireargs(self, one, two, three=None, four=None, five=None): | ||||
| # don't pass optional arguments left at their default value | # don't pass optional arguments left at their default value | ||||
| opts = {} | opts = {} | ||||
| if three is not None: | if three is not None: | ||||
| opts['three'] = three | opts['three'] = three | ||||
| if four is not None: | if four is not None: | ||||
| opts['four'] = four | opts['four'] = four | ||||