Show More
@@ -79,7 +79,7 b" Any value other than 'ansi', 'win32', or" | |||||
79 |
|
79 | |||
80 | import os |
|
80 | import os | |
81 |
|
81 | |||
82 | from mercurial import commands, dispatch, extensions, ui as uimod |
|
82 | from mercurial import commands, dispatch, extensions, ui as uimod, util | |
83 | from mercurial.i18n import _ |
|
83 | from mercurial.i18n import _ | |
84 |
|
84 | |||
85 | # start and stop parameters for effects |
|
85 | # start and stop parameters for effects | |
@@ -209,9 +209,12 b' def uisetup(ui):' | |||||
209 | elif mode != 'ansi': |
|
209 | elif mode != 'ansi': | |
210 | return |
|
210 | return | |
211 | def colorcmd(orig, ui_, opts, cmd, cmdfunc): |
|
211 | def colorcmd(orig, ui_, opts, cmd, cmdfunc): | |
212 |
|
|
212 | coloropt = opts['color'] | |
213 | (opts['color'] == 'auto' and (os.environ.get('TERM') != 'dumb' |
|
213 | auto = coloropt == 'auto' | |
214 | and ui_.formatted()))): |
|
214 | always = util.parsebool(coloropt) | |
|
215 | if (always or | |||
|
216 | (always is None and | |||
|
217 | (auto and (os.environ.get('TERM') != 'dumb' and ui_.formatted())))): | |||
215 | colorui._colormode = mode |
|
218 | colorui._colormode = mode | |
216 | colorui.__bases__ = (ui_.__class__,) |
|
219 | colorui.__bases__ = (ui_.__class__,) | |
217 | ui_.__class__ = colorui |
|
220 | ui_.__class__ = colorui | |
@@ -220,8 +223,9 b' def uisetup(ui):' | |||||
220 | return orig(ui_, opts, cmd, cmdfunc) |
|
223 | return orig(ui_, opts, cmd, cmdfunc) | |
221 | extensions.wrapfunction(dispatch, '_runcommand', colorcmd) |
|
224 | extensions.wrapfunction(dispatch, '_runcommand', colorcmd) | |
222 |
|
225 | |||
223 |
commands.globalopts.append( |
|
226 | commands.globalopts.append( | |
224 | _("when to colorize (always, auto, or never)"), |
|
227 | ('', 'color', 'auto', | |
|
228 | _("when to colorize (boolean, always, auto, or never)"), | |||
225 | _('TYPE'))) |
|
229 | _('TYPE'))) | |
226 |
|
230 | |||
227 | try: |
|
231 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now