wireproto: add a ``boolean`` type for getbundle parameters
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 22 May 2014 17:20:52 -0700
changeset 21988 12cd3827b860
parent 21987 4953cd193e84
child 21989 bdb6d97f0a04
wireproto: add a ``boolean`` type for getbundle parameters This will be used to control inclusion of some parts in a bundle2.
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Sun Aug 03 19:19:23 2014 +0900
+++ b/mercurial/wireproto.py	Thu May 22 17:20:52 2014 -0700
@@ -349,6 +349,8 @@
                 value = encodelist(value)
             elif keytype == 'csv':
                 value = ','.join(value)
+            elif keytype == 'boolean':
+                value = bool(value)
             elif keytype != 'plain':
                 raise KeyError('unknown getbundle option type %s'
                                % keytype)
@@ -652,6 +654,8 @@
             opts[k] = decodelist(v)
         elif keytype == 'csv':
             opts[k] = set(v.split(','))
+        elif keytype == 'boolean':
+            opts[k] = '%i' % bool(v)
         elif keytype != 'plain':
             raise KeyError('unknown getbundle option type %s'
                            % keytype)