##// 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 193 return 'debug'
194 194
195 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 204 if not always and not auto:
198 205 return None
199 206
@@ -5,15 +5,15 b' in red, while the status command shows m'
5 5 other commands have analogous colors. It is possible to customize
6 6 these colors.
7 7
8 To enable color (default) use::
8 To enable color (default) whenever possible use::
9 9
10 10 [ui]
11 color = auto
11 color = yes
12 12
13 13 To disable color use::
14 14
15 15 [ui]
16 color = never
16 color = no
17 17
18 18 See :hg:`help config.ui.color` for details.
19 19
@@ -1884,9 +1884,9 b' User interface controls.'
1884 1884 By default, the first bundle advertised by the server is used.
1885 1885
1886 1886 ``color``
1887 When to colorize output. Possible value are Boolean, "always", "auto",
1888 "never", or "debug". (default: "auto"). "auto" will use color
1889 whenever it seems possible. See :hg:`help color` for details.
1887 When to colorize output. Possible value are Boolean ("yes" or "no"), or
1888 "debug". (default: "yes"). "yes" will use color whenever it seems possible.
1889 See :hg:`help color` for details.
1890 1890
1891 1891 ``commitsubrepos``
1892 1892 Whether to commit modified subrepositories when committing the
@@ -3,6 +3,7 b' Setup'
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [ui]
5 5 > color = always
6 > formatted = always
6 7 > [color]
7 8 > mode = ansi
8 9 > EOF
@@ -49,6 +50,38 b' default context'
49 50 a
50 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 85 --unified=2
53 86
54 87 $ hg diff --nodates -U 2
@@ -161,6 +161,7 b' even though stdout is no longer a tty.'
161 161 $ cat >> $HGRCPATH <<EOF
162 162 > [ui]
163 163 > color = yes
164 > formatted = yes
164 165 > [color]
165 166 > mode = ansi
166 167 > EOF
@@ -142,6 +142,7 b' even though stdout is no longer a tty.'
142 142 $ cat >> $HGRCPATH <<EOF
143 143 > [ui]
144 144 > color = yes
145 > formatted = yes
145 146 > [color]
146 147 > mode = ansi
147 148 > EOF
@@ -1,6 +1,7 b''
1 1 $ cat <<EOF >> $HGRCPATH
2 2 > [ui]
3 3 > color = always
4 > formatted = yes
4 5 > [color]
5 6 > mode = ansi
6 7 > EOF
General Comments 0
You need to be logged in to leave comments. Login now