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.
--- 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)