##// END OF EJS Templates
color: turn 'ui.color' into a boolean (auto or off)...
Pierre-Yves David -
r32103:9a85ea1d stable
parent child Browse files
Show More
@@ -193,7 +193,14 b' def _modesetup(ui):'
193 return 'debug'
193 return 'debug'
194
194
195 auto = (config == 'auto')
195 auto = (config == 'auto')
196 always = not auto and util.parsebool(config)
196 always = False
197 if not auto and util.parsebool(config):
198 # we want the config to behave like a boolean, "on" is actually auto
199 if ui.configsource('ui', 'color') == '--color':
200 always = True
201 else:
202 auto = True
203
197 if not always and not auto:
204 if not always and not auto:
198 return None
205 return None
199
206
@@ -5,15 +5,15 b' in red, while the status command shows m'
5 other commands have analogous colors. It is possible to customize
5 other commands have analogous colors. It is possible to customize
6 these colors.
6 these colors.
7
7
8 To enable color (default) use::
8 To enable color (default) whenever possible use::
9
9
10 [ui]
10 [ui]
11 color = auto
11 color = yes
12
12
13 To disable color use::
13 To disable color use::
14
14
15 [ui]
15 [ui]
16 color = never
16 color = no
17
17
18 See :hg:`help config.ui.color` for details.
18 See :hg:`help config.ui.color` for details.
19
19
@@ -1884,9 +1884,9 b' User interface controls.'
1884 By default, the first bundle advertised by the server is used.
1884 By default, the first bundle advertised by the server is used.
1885
1885
1886 ``color``
1886 ``color``
1887 When to colorize output. Possible value are Boolean, "always", "auto",
1887 When to colorize output. Possible value are Boolean ("yes" or "no"), or
1888 "never", or "debug". (default: "auto"). "auto" will use color
1888 "debug". (default: "yes"). "yes" will use color whenever it seems possible.
1889 whenever it seems possible. See :hg:`help color` for details.
1889 See :hg:`help color` for details.
1890
1890
1891 ``commitsubrepos``
1891 ``commitsubrepos``
1892 Whether to commit modified subrepositories when committing the
1892 Whether to commit modified subrepositories when committing the
@@ -3,6 +3,7 b' Setup'
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
4 > [ui]
5 > color = always
5 > color = always
6 > formatted = always
6 > [color]
7 > [color]
7 > mode = ansi
8 > mode = ansi
8 > EOF
9 > EOF
@@ -49,6 +50,38 b' default context'
49 a
50 a
50 c
51 c
51
52
53 (check that 'ui.color=yes' match '--color=auto')
54
55 $ hg diff --nodates --config ui.formatted=no
56 diff -r cf9f4ba66af2 a
57 --- a/a
58 +++ b/a
59 @@ -2,7 +2,7 @@
60 c
61 a
62 a
63 -b
64 +dd
65 a
66 a
67 c
68
69 (check that 'ui.color=no' disable color)
70
71 $ hg diff --nodates --config ui.formatted=yes --config ui.color=no
72 diff -r cf9f4ba66af2 a
73 --- a/a
74 +++ b/a
75 @@ -2,7 +2,7 @@
76 c
77 a
78 a
79 -b
80 +dd
81 a
82 a
83 c
84
52 --unified=2
85 --unified=2
53
86
54 $ hg diff --nodates -U 2
87 $ hg diff --nodates -U 2
@@ -161,6 +161,7 b' even though stdout is no longer a tty.'
161 $ cat >> $HGRCPATH <<EOF
161 $ cat >> $HGRCPATH <<EOF
162 > [ui]
162 > [ui]
163 > color = yes
163 > color = yes
164 > formatted = yes
164 > [color]
165 > [color]
165 > mode = ansi
166 > mode = ansi
166 > EOF
167 > EOF
@@ -142,6 +142,7 b' even though stdout is no longer a tty.'
142 $ cat >> $HGRCPATH <<EOF
142 $ cat >> $HGRCPATH <<EOF
143 > [ui]
143 > [ui]
144 > color = yes
144 > color = yes
145 > formatted = yes
145 > [color]
146 > [color]
146 > mode = ansi
147 > mode = ansi
147 > EOF
148 > EOF
@@ -1,6 +1,7 b''
1 $ cat <<EOF >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [ui]
2 > [ui]
3 > color = always
3 > color = always
4 > formatted = yes
4 > [color]
5 > [color]
5 > mode = ansi
6 > mode = ansi
6 > EOF
7 > EOF
General Comments 0
You need to be logged in to leave comments. Login now