[PATCH 2 of 2] color: be silent when falling back to ECMA-48 mode if "auto" mode was desired

Danek Duvall duvall at comfychair.org
Mon Jun 27 14:52:48 CDT 2011


# HG changeset patch
# User Danek Duvall <duvall at comfychair.org>
# Date 1309199802 25200
# Node ID ffb4466797e47df5f4ee3aebac4322dfa767aaef
# Parent  dd9c946e271859a2052573fcf487aa5983123377
color: be silent when falling back to ECMA-48 mode if "auto" mode was desired

Don't warn about missing setab/setaf terminfo entries unless we explicitly
asked for terminfo mode; fallback to ECMA-48 mode silently.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -144,8 +144,11 @@ def _terminfosetup(ui, mode):
             ui.debug("no terminfo entry for %s\n" % e)
             del _terminfo_params[key]
     if not curses.tigetstr('setaf') or not curses.tigetstr('setab'):
-        ui.warn(_("no terminfo entry for setab/setaf: reverting to "
-          "ECMA-48 color\n"))
+        # Only warn about missing terminfo entries if we explicitly asked for
+        # terminfo mode.
+        if mode == "terminfo":
+            ui.warn(_("no terminfo entry for setab/setaf: reverting to "
+              "ECMA-48 color\n"))
         _terminfo_params = {}
 
 def _modesetup(ui, opts):


More information about the Mercurial-devel mailing list