# HG changeset patch # User Gregory Szorc # Date 2015-10-14 17:58:35 # Node ID 3e7f675628adc14e3c7a41e9b558a586780aebfb # Parent ea390d889d3a7433ef2c3a629f81eb71f5459af0 wireproto: properly parse false boolean args (BC) The client represents boolean arguments as '0' and '1'. bool('0') == bool('1') == True, so a simple bool(val) isn't sufficient for converting the argument back to a bool type. Currently, "obsmarkers" is the only boolean argument to getbundle. I /think/ the only place where we currently set the "obsmarkers" argument is during bundle2 pulls. As a result of this bug, the server /might/ be sending obsolete markers bundle2 part(s) to clients that don't request them. That is why I marked this BC. Surprisingly there was no test fall out from this change. I suspect a lapse in test coverage. diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -625,7 +625,12 @@ def getbundle(repo, proto, others): elif keytype == 'scsv': opts[k] = set(v.split(',')) elif keytype == 'boolean': - opts[k] = bool(v) + # Client should serialize False as '0', which is a non-empty string + # so it evaluates as a True bool. + if v == '0': + opts[k] = False + else: + opts[k] = bool(v) elif keytype != 'plain': raise KeyError('unknown getbundle option type %s' % keytype)