equal
deleted
inserted
replaced
98 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will |
98 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will |
99 disable color. |
99 disable color. |
100 |
100 |
101 ''' |
101 ''' |
102 |
102 |
103 import os |
103 import os, sys |
104 |
104 |
105 from mercurial import commands, dispatch, extensions, ui as uimod, util |
105 from mercurial import commands, dispatch, extensions, ui as uimod, util |
106 from mercurial.i18n import _ |
106 from mercurial.i18n import _ |
107 |
107 |
108 # start and stop parameters for effects |
108 # start and stop parameters for effects |
305 if mode == 'auto': |
305 if mode == 'auto': |
306 if os.name == 'nt' and 'TERM' not in os.environ: |
306 if os.name == 'nt' and 'TERM' not in os.environ: |
307 # looks line a cmd.exe console, use win32 API or nothing |
307 # looks line a cmd.exe console, use win32 API or nothing |
308 mode = w32effects and 'win32' or 'none' |
308 mode = w32effects and 'win32' or 'none' |
309 else: |
309 else: |
310 _terminfosetup(ui) |
310 if getattr(sys.stdout, 'isatty', None) and sys.stdout.isatty(): |
311 if not _terminfo_params: |
311 _terminfo_params = False |
312 mode = 'ansi' |
|
313 else: |
312 else: |
314 mode = 'terminfo' |
313 _terminfosetup(ui) |
|
314 if not _terminfo_params: |
|
315 mode = 'ansi' |
|
316 else: |
|
317 mode = 'terminfo' |
315 if mode == 'win32': |
318 if mode == 'win32': |
316 if w32effects is None: |
319 if w32effects is None: |
317 # only warn if color.mode is explicitly set to win32 |
320 # only warn if color.mode is explicitly set to win32 |
318 ui.warn(_('warning: failed to set color mode to %s\n') % mode) |
321 ui.warn(_('warning: failed to set color mode to %s\n') % mode) |
319 return |
322 return |