wireproto: don't special case bundlecaps, but sort all scsv arguments
authorJoerg Sonnenberger <joerg@bec.de>
Fri, 06 Apr 2018 22:16:11 +0200
changeset 37412 1d459f61b42a
parent 37411 3e1688711efd
child 37413 33af46d639b4
wireproto: don't special case bundlecaps, but sort all scsv arguments Differential Revision: https://phab.mercurial-scm.org/D3170
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Fri Apr 06 21:50:01 2018 +0200
+++ b/mercurial/wireproto.py	Fri Apr 06 22:16:11 2018 +0200
@@ -297,11 +297,7 @@
         kwargs = pycompat.byteskwargs(kwargs)
         self.requirecap('getbundle', _('look up remote changes'))
         opts = {}
-        bundlecaps = kwargs.get('bundlecaps')
-        if bundlecaps is not None:
-            kwargs['bundlecaps'] = sorted(bundlecaps)
-        else:
-            bundlecaps = () # kwargs could have it to None
+        bundlecaps = kwargs.get('bundlecaps') or set()
         for key, value in kwargs.iteritems():
             if value is None:
                 continue
@@ -311,8 +307,10 @@
                     'Unexpectedly None keytype for key %s' % key)
             elif keytype == 'nodes':
                 value = encodelist(value)
-            elif keytype in ('csv', 'scsv'):
+            elif keytype == 'csv':
                 value = ','.join(value)
+            elif keytype == 'scsv':
+                value = ','.join(sorted(value))
             elif keytype == 'boolean':
                 value = '%i' % bool(value)
             elif keytype != 'plain':