diff -r b44ab288358e -r 8903f67b9ca8 hgext/color.py --- a/hgext/color.py Sat Feb 25 21:13:59 2017 -0500 +++ b/hgext/color.py Thu Dec 22 14:17:52 2016 +0100 @@ -192,45 +192,6 @@ # leave the attribute unspecified. testedwith = 'ships-with-hg-core' -def _terminfosetup(ui, mode): - '''Initialize terminfo data and the terminal if we're in terminfo mode.''' - - # If we failed to load curses, we go ahead and return. - if curses is None: - return - # Otherwise, see what the config file says. - if mode not in ('auto', 'terminfo'): - return - - for key, val in ui.configitems('color'): - if key.startswith('color.'): - newval = (False, int(val), '') - color._terminfo_params[key[6:]] = newval - elif key.startswith('terminfo.'): - newval = (True, '', val.replace('\\E', '\x1b')) - color._terminfo_params[key[9:]] = newval - try: - curses.setupterm() - except curses.error as e: - color._terminfo_params.clear() - return - - for key, (b, e, c) in color._terminfo_params.items(): - if not b: - continue - if not c and not curses.tigetstr(e): - # Most terminals don't support dim, invis, etc, so don't be - # noisy and use ui.debug(). - ui.debug("no terminfo entry for %s\n" % e) - del color._terminfo_params[key] - if not curses.tigetstr('setaf') or not curses.tigetstr('setab'): - # 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")) - color._terminfo_params.clear() - def _modesetup(ui, coloropt): if coloropt == 'debug': return 'debug' @@ -284,7 +245,7 @@ elif realmode == 'ansi': color._terminfo_params.clear() elif realmode == 'terminfo': - _terminfosetup(ui, mode) + color._terminfosetup(ui, mode) if not color._terminfo_params: ## FIXME Shouldn't we return None in this case too? modewarn()