Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG1d459f61b42a: wireproto: don't special case bundlecaps, but sort all scsv arguments
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/wireproto.py (10 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | joerg.sonnenberger | ||
Closed | joerg.sonnenberger | ||
Closed | joerg.sonnenberger |
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) | 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') or set() | ||||
if bundlecaps is not None: | |||||
kwargs['bundlecaps'] = sorted(bundlecaps) | |||||
else: | |||||
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 == 'csv': | ||||
value = ','.join(value) | value = ','.join(value) | ||||
elif keytype == 'scsv': | |||||
value = ','.join(sorted(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", **pycompat.strkwargs(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)): |