[PATCH 3 of 3] diffopts: notice a negated boolean flag in diffopts

Yuya Nishihara yuya at tcha.org
Mon Aug 22 10:01:45 EDT 2016


On Thu, 18 Aug 2016 12:13:34 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1471534521 14400
> #      Thu Aug 18 11:35:21 2016 -0400
> # Node ID 16491c79cf9b9b61550342690c680ed192506b08
> # Parent  9ec3aad0bf74ad1c25e87bcd0f536896d1c355ca
> diffopts: notice a negated boolean flag in diffopts
> 
> This means that if you have git-diffs enabled by default (pretty
> common) and you hit the rare (but real) case where a git-diff breaks
> patch(1) or some other tool, you can easily disable it by just
> specifying --git=0 on the command line.
> 
> diff --git a/mercurial/patch.py b/mercurial/patch.py
> --- a/mercurial/patch.py
> +++ b/mercurial/patch.py
> @@ -2142,7 +2142,7 @@ def difffeatureopts(ui, opts=None, untru
>      def get(key, name=None, getter=ui.configbool, forceplain=None):
>          if opts:
>              v = opts.get(key)
> -            if v:
> +            if v or v is False:

I'm afraid that False/True/None tristate would cause subtle bugs. It seems
we choose None or False randomly as the default value of boolean command
options.


More information about the Mercurial-devel mailing list