# HG changeset patch # User Gregory Szorc # Date 1444845515 25200 # 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 -r ea390d889d3a -r 3e7f675628ad mercurial/wireproto.py --- a/mercurial/wireproto.py Thu Oct 15 03:29:00 2015 +0100 +++ b/mercurial/wireproto.py Wed Oct 14 10:58:35 2015 -0700 @@ -625,7 +625,12 @@ 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)