[PATCH] color: add parenthesis to help readability

Augie Fackler raf at durin42.com
Sat Jun 7 08:38:39 CDT 2014


On Mon, Jun 02, 2014 at 12:50:13PM -0700, pierre-yves.david at ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1401474528 25200
> #      Fri May 30 11:28:48 2014 -0700
> # Node ID 44ded2121b08d82636c922a42f2befb7bb17605c
> # Parent  25732fab4dc35a76cfb8f659fde48c7e0dc42dbf
> color: add parenthesis to help readability

Righteous. Queued.

>
> Took me a multiple attempts until my mind eventually stop reading:
>
>   auto = coloropt = 'auto'
>
> And properly reads:
>
>   auto = colorpopt == 'auto'
>
> So we add parenthesis to clarify.
>
> diff --git a/hgext/color.py b/hgext/color.py
> --- a/hgext/color.py
> +++ b/hgext/color.py
> @@ -166,11 +166,11 @@ def _terminfosetup(ui, mode):
>          _terminfo_params = {}
>
>  def _modesetup(ui, coloropt):
>      global _terminfo_params
>
> -    auto = coloropt == 'auto'
> +    auto = (coloropt == 'auto')
>      always = not auto and util.parsebool(coloropt)
>      if not always and not auto:
>          return None
>
>      formatted = always or (os.environ.get('TERM') != 'dumb' and ui.formatted())
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list