equal
deleted
inserted
replaced
|
1 from __future__ import print_function |
1 import os |
2 import os |
2 from hgext import color |
3 from hgext import color |
3 from mercurial import dispatch, ui |
4 from mercurial import dispatch, ui |
4 |
5 |
5 # ensure errors aren't buffered |
6 # ensure errors aren't buffered |
6 testui = color.colorui() |
7 testui = color.colorui() |
7 testui.pushbuffer() |
8 testui.pushbuffer() |
8 testui.write(('buffered\n')) |
9 testui.write(('buffered\n')) |
9 testui.warn(('warning\n')) |
10 testui.warn(('warning\n')) |
10 testui.write_err('error\n') |
11 testui.write_err('error\n') |
11 print repr(testui.popbuffer()) |
12 print(repr(testui.popbuffer())) |
12 |
13 |
13 # test dispatch.dispatch with the same ui object |
14 # test dispatch.dispatch with the same ui object |
14 hgrc = open(os.environ["HGRCPATH"], 'w') |
15 hgrc = open(os.environ["HGRCPATH"], 'w') |
15 hgrc.write('[extensions]\n') |
16 hgrc.write('[extensions]\n') |
16 hgrc.write('color=\n') |
17 hgrc.write('color=\n') |
26 # color's wrapped _runcommand twice. |
27 # color's wrapped _runcommand twice. |
27 def runcmd(): |
28 def runcmd(): |
28 dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) |
29 dispatch.dispatch(dispatch.request(['version', '-q'], ui_)) |
29 |
30 |
30 runcmd() |
31 runcmd() |
31 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) |
32 print("colored? " + str(issubclass(ui_.__class__, color.colorui))) |
32 runcmd() |
33 runcmd() |
33 print "colored? " + str(issubclass(ui_.__class__, color.colorui)) |
34 print("colored? " + str(issubclass(ui_.__class__, color.colorui))) |