Patchwork D3170: wireproto: don't special case bundlecaps, but sort all scsv arguments

login
register
mail settings
Submitter phabricator
Date April 6, 2018, 9:39 p.m.
Message ID <differential-rev-PHID-DREV-4vn2bxflqki4nilwz5g2-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30464/
State Superseded
Headers show

Comments

phabricator - April 6, 2018, 9:39 p.m.
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3170

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel
phabricator - April 6, 2018, 10:03 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  `scsv` types are parsed into a `set`. So this should pose no BC problems.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3170

To: joerg.sonnenberger, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -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':