[PATCH] color: add parenthesis to help readability

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Mon Jun 2 14:50:13 CDT 2014


# 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

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


More information about the Mercurial-devel mailing list