[PATCH 1 of 2] wireproto: add a ``boolean`` type for getbundle parameters

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Mon Aug 4 18:41:32 UTC 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1400804452 25200
#      Thu May 22 17:20:52 2014 -0700
# Node ID d45398ff6b1cf799b0e76b0d1f8c3e30b0079ba9
# Parent  3467cf39aae688e844d5c1c22b7daa85c590bef9
wireproto: add a ``boolean`` type for getbundle parameters

This will be used to control inclusion of some part in a bundle2.

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -347,10 +347,12 @@ class wirepeer(peer.peerrepository):
                 assert False, 'unexpected'
             elif keytype == 'nodes':
                 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)
             opts[key] = value
         f = self._callcompressable("getbundle", **opts)
@@ -650,10 +652,12 @@ def getbundle(repo, proto, others):
         keytype = gboptsmap[k]
         if keytype == 'nodes':
             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)
     cg = exchange.getbundle(repo, 'serve', **opts)
     return streamres(proto.groupchunks(cg))


More information about the Mercurial-devel mailing list