From patchwork Mon Aug 4 18:41:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,2] wireproto: add a ``boolean`` type for getbundle parameters From: Pierre-Yves David X-Patchwork-Id: 5248 Message-Id: To: mercurial-devel@selenic.com Cc: pierre-yves.david@ens-lyon.org Date: Mon, 04 Aug 2014 11:41:32 -0700 # HG changeset patch # User Pierre-Yves David # 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))