Mercurial > hg
comparison mercurial/wireproto.py @ 26686:3e7f675628ad
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.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 14 Oct 2015 10:58:35 -0700 |
parents | 56b2bcea2529 |
children | 704818fb170d |
comparison
equal
deleted
inserted
replaced
26685:ea390d889d3a | 26686:3e7f675628ad |
---|---|
623 elif keytype == 'csv': | 623 elif keytype == 'csv': |
624 opts[k] = list(v.split(',')) | 624 opts[k] = list(v.split(',')) |
625 elif keytype == 'scsv': | 625 elif keytype == 'scsv': |
626 opts[k] = set(v.split(',')) | 626 opts[k] = set(v.split(',')) |
627 elif keytype == 'boolean': | 627 elif keytype == 'boolean': |
628 opts[k] = bool(v) | 628 # Client should serialize False as '0', which is a non-empty string |
629 # so it evaluates as a True bool. | |
630 if v == '0': | |
631 opts[k] = False | |
632 else: | |
633 opts[k] = bool(v) | |
629 elif keytype != 'plain': | 634 elif keytype != 'plain': |
630 raise KeyError('unknown getbundle option type %s' | 635 raise KeyError('unknown getbundle option type %s' |
631 % keytype) | 636 % keytype) |
632 cg = exchange.getbundle(repo, 'serve', **opts) | 637 cg = exchange.getbundle(repo, 'serve', **opts) |
633 return streamres(proto.groupchunks(cg)) | 638 return streamres(proto.groupchunks(cg)) |