# HG changeset patch # User Gregory Szorc # Date 1506857373 -3600 # Node ID 407ebe7a9b934204408adcfe3aa338bcfd4d03e9 # Parent 689f6cdccef5082ed706c5b39a82388a16b6d29c hgweb: use parsebool for parsing diff query string options Differential Revision: https://phab.mercurial-scm.org/D875 diff -r 689f6cdccef5 -r 407ebe7a9b93 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Sun Oct 01 14:02:47 2017 +0100 +++ b/mercurial/hgweb/webcommands.py Sun Oct 01 12:29:33 2017 +0100 @@ -865,9 +865,10 @@ The ``ignorews``, ``ignorewsamount``, ``ignorewseol``, and ``ignoreblanklines`` query string arguments have the same meaning as - their ``[annotate]`` config equivalents. A value of ``0`` sets the - whitespace option to false. All other values are true. If not defined, - the server default settings are used. + their ``[annotate]`` config equivalents. It uses the hgrc boolean + parsing logic to interpret the value. e.g. ``0`` and ``false`` are + false and ``1`` and ``true`` are true. If not defined, the server + default settings are used. The ``fileannotate`` template is rendered. """ diff -r 689f6cdccef5 -r 407ebe7a9b93 mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Sun Oct 01 14:02:47 2017 +0100 +++ b/mercurial/hgweb/webutil.py Sun Oct 01 12:29:33 2017 +0100 @@ -177,12 +177,8 @@ for k in ('ignorews', 'ignorewsamount', 'ignorewseol', 'ignoreblanklines'): v = req.form.get(k, [None])[0] if v is not None: - try: - v = bool(int(v)) - except ValueError: - v = True - - setattr(diffopts, k, v) + v = util.parsebool(v) + setattr(diffopts, k, v if v is not None else True) return diffopts