Show More
@@ -296,18 +296,12 b' def _modesetup(ui, coloropt):' | |||
|
296 | 296 | return realmode |
|
297 | 297 | return None |
|
298 | 298 | |
|
299 | class colorui(uimod.ui): | |
|
300 | pass | |
|
301 | ||
|
302 | 299 | def uisetup(ui): |
|
303 | 300 | if ui.plain(): |
|
304 | 301 | return |
|
305 | if not isinstance(ui, colorui): | |
|
306 | colorui.__bases__ = (ui.__class__,) | |
|
307 | ui.__class__ = colorui | |
|
308 | 302 | def colorcmd(orig, ui_, opts, cmd, cmdfunc): |
|
309 | 303 | mode = _modesetup(ui_, opts['color']) |
|
310 |
|
|
|
304 | uimod.ui._colormode = mode | |
|
311 | 305 | if mode and mode != 'debug': |
|
312 | 306 | color.configstyles(ui_) |
|
313 | 307 | return orig(ui_, opts, cmd, cmdfunc) |
@@ -1,16 +1,13 b'' | |||
|
1 | 1 | from __future__ import absolute_import, print_function |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | from hgext import ( | |
|
5 | color, | |
|
6 | ) | |
|
7 | 4 | from mercurial import ( |
|
8 | 5 | dispatch, |
|
9 | 6 | ui as uimod, |
|
10 | 7 | ) |
|
11 | 8 | |
|
12 | 9 | # ensure errors aren't buffered |
|
13 |
testui = |
|
|
10 | testui = uimod.ui() | |
|
14 | 11 | testui.pushbuffer() |
|
15 | 12 | testui.write(('buffered\n')) |
|
16 | 13 | testui.warn(('warning\n')) |
@@ -35,6 +32,7 b' def runcmd():' | |||
|
35 | 32 | dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) |
|
36 | 33 | |
|
37 | 34 | runcmd() |
|
38 | print("colored? " + str(issubclass(ui_.__class__, color.colorui))) | |
|
35 | print("colored? %s" % (ui_._colormode is not None)) | |
|
39 | 36 | runcmd() |
|
40 | print("colored? " + str(issubclass(ui_.__class__, color.colorui))) | |
|
37 | print("colored? %s" % (ui_._colormode is not None)) | |
|
38 |
General Comments 0
You need to be logged in to leave comments.
Login now