##// END OF EJS Templates
addremove: add associated color for the new labels...
Boris Feld -
r39126:ddc1da13 default
parent child Browse files
Show More
@@ -1,535 +1,537 b''
1 # utility for color output for Mercurial commands
1 # utility for color output for Mercurial commands
2 #
2 #
3 # Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com> and other
3 # Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com> and other
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import re
10 import re
11
11
12 from .i18n import _
12 from .i18n import _
13
13
14 from . import (
14 from . import (
15 encoding,
15 encoding,
16 pycompat,
16 pycompat,
17 )
17 )
18
18
19 from .utils import (
19 from .utils import (
20 stringutil,
20 stringutil,
21 )
21 )
22
22
23 try:
23 try:
24 import curses
24 import curses
25 # Mapping from effect name to terminfo attribute name (or raw code) or
25 # Mapping from effect name to terminfo attribute name (or raw code) or
26 # color number. This will also force-load the curses module.
26 # color number. This will also force-load the curses module.
27 _baseterminfoparams = {
27 _baseterminfoparams = {
28 'none': (True, 'sgr0', ''),
28 'none': (True, 'sgr0', ''),
29 'standout': (True, 'smso', ''),
29 'standout': (True, 'smso', ''),
30 'underline': (True, 'smul', ''),
30 'underline': (True, 'smul', ''),
31 'reverse': (True, 'rev', ''),
31 'reverse': (True, 'rev', ''),
32 'inverse': (True, 'rev', ''),
32 'inverse': (True, 'rev', ''),
33 'blink': (True, 'blink', ''),
33 'blink': (True, 'blink', ''),
34 'dim': (True, 'dim', ''),
34 'dim': (True, 'dim', ''),
35 'bold': (True, 'bold', ''),
35 'bold': (True, 'bold', ''),
36 'invisible': (True, 'invis', ''),
36 'invisible': (True, 'invis', ''),
37 'italic': (True, 'sitm', ''),
37 'italic': (True, 'sitm', ''),
38 'black': (False, curses.COLOR_BLACK, ''),
38 'black': (False, curses.COLOR_BLACK, ''),
39 'red': (False, curses.COLOR_RED, ''),
39 'red': (False, curses.COLOR_RED, ''),
40 'green': (False, curses.COLOR_GREEN, ''),
40 'green': (False, curses.COLOR_GREEN, ''),
41 'yellow': (False, curses.COLOR_YELLOW, ''),
41 'yellow': (False, curses.COLOR_YELLOW, ''),
42 'blue': (False, curses.COLOR_BLUE, ''),
42 'blue': (False, curses.COLOR_BLUE, ''),
43 'magenta': (False, curses.COLOR_MAGENTA, ''),
43 'magenta': (False, curses.COLOR_MAGENTA, ''),
44 'cyan': (False, curses.COLOR_CYAN, ''),
44 'cyan': (False, curses.COLOR_CYAN, ''),
45 'white': (False, curses.COLOR_WHITE, ''),
45 'white': (False, curses.COLOR_WHITE, ''),
46 }
46 }
47 except ImportError:
47 except ImportError:
48 curses = None
48 curses = None
49 _baseterminfoparams = {}
49 _baseterminfoparams = {}
50
50
51 # start and stop parameters for effects
51 # start and stop parameters for effects
52 _effects = {
52 _effects = {
53 'none': 0,
53 'none': 0,
54 'black': 30,
54 'black': 30,
55 'red': 31,
55 'red': 31,
56 'green': 32,
56 'green': 32,
57 'yellow': 33,
57 'yellow': 33,
58 'blue': 34,
58 'blue': 34,
59 'magenta': 35,
59 'magenta': 35,
60 'cyan': 36,
60 'cyan': 36,
61 'white': 37,
61 'white': 37,
62 'bold': 1,
62 'bold': 1,
63 'italic': 3,
63 'italic': 3,
64 'underline': 4,
64 'underline': 4,
65 'inverse': 7,
65 'inverse': 7,
66 'dim': 2,
66 'dim': 2,
67 'black_background': 40,
67 'black_background': 40,
68 'red_background': 41,
68 'red_background': 41,
69 'green_background': 42,
69 'green_background': 42,
70 'yellow_background': 43,
70 'yellow_background': 43,
71 'blue_background': 44,
71 'blue_background': 44,
72 'purple_background': 45,
72 'purple_background': 45,
73 'cyan_background': 46,
73 'cyan_background': 46,
74 'white_background': 47,
74 'white_background': 47,
75 }
75 }
76
76
77 _defaultstyles = {
77 _defaultstyles = {
78 'grep.match': 'red bold',
78 'grep.match': 'red bold',
79 'grep.linenumber': 'green',
79 'grep.linenumber': 'green',
80 'grep.rev': 'green',
80 'grep.rev': 'green',
81 'grep.change': 'green',
81 'grep.change': 'green',
82 'grep.sep': 'cyan',
82 'grep.sep': 'cyan',
83 'grep.filename': 'magenta',
83 'grep.filename': 'magenta',
84 'grep.user': 'magenta',
84 'grep.user': 'magenta',
85 'grep.date': 'magenta',
85 'grep.date': 'magenta',
86 'addremove.added': 'green',
87 'addremove.removed': 'red',
86 'bookmarks.active': 'green',
88 'bookmarks.active': 'green',
87 'branches.active': 'none',
89 'branches.active': 'none',
88 'branches.closed': 'black bold',
90 'branches.closed': 'black bold',
89 'branches.current': 'green',
91 'branches.current': 'green',
90 'branches.inactive': 'none',
92 'branches.inactive': 'none',
91 'diff.changed': 'white',
93 'diff.changed': 'white',
92 'diff.deleted': 'red',
94 'diff.deleted': 'red',
93 'diff.deleted.changed': 'red bold underline',
95 'diff.deleted.changed': 'red bold underline',
94 'diff.deleted.unchanged': 'red',
96 'diff.deleted.unchanged': 'red',
95 'diff.diffline': 'bold',
97 'diff.diffline': 'bold',
96 'diff.extended': 'cyan bold',
98 'diff.extended': 'cyan bold',
97 'diff.file_a': 'red bold',
99 'diff.file_a': 'red bold',
98 'diff.file_b': 'green bold',
100 'diff.file_b': 'green bold',
99 'diff.hunk': 'magenta',
101 'diff.hunk': 'magenta',
100 'diff.inserted': 'green',
102 'diff.inserted': 'green',
101 'diff.inserted.changed': 'green bold underline',
103 'diff.inserted.changed': 'green bold underline',
102 'diff.inserted.unchanged': 'green',
104 'diff.inserted.unchanged': 'green',
103 'diff.tab': '',
105 'diff.tab': '',
104 'diff.trailingwhitespace': 'bold red_background',
106 'diff.trailingwhitespace': 'bold red_background',
105 'changeset.public': '',
107 'changeset.public': '',
106 'changeset.draft': '',
108 'changeset.draft': '',
107 'changeset.secret': '',
109 'changeset.secret': '',
108 'diffstat.deleted': 'red',
110 'diffstat.deleted': 'red',
109 'diffstat.inserted': 'green',
111 'diffstat.inserted': 'green',
110 'formatvariant.name.mismatchconfig': 'red',
112 'formatvariant.name.mismatchconfig': 'red',
111 'formatvariant.name.mismatchdefault': 'yellow',
113 'formatvariant.name.mismatchdefault': 'yellow',
112 'formatvariant.name.uptodate': 'green',
114 'formatvariant.name.uptodate': 'green',
113 'formatvariant.repo.mismatchconfig': 'red',
115 'formatvariant.repo.mismatchconfig': 'red',
114 'formatvariant.repo.mismatchdefault': 'yellow',
116 'formatvariant.repo.mismatchdefault': 'yellow',
115 'formatvariant.repo.uptodate': 'green',
117 'formatvariant.repo.uptodate': 'green',
116 'formatvariant.config.special': 'yellow',
118 'formatvariant.config.special': 'yellow',
117 'formatvariant.config.default': 'green',
119 'formatvariant.config.default': 'green',
118 'formatvariant.default': '',
120 'formatvariant.default': '',
119 'histedit.remaining': 'red bold',
121 'histedit.remaining': 'red bold',
120 'ui.error': 'red',
122 'ui.error': 'red',
121 'ui.prompt': 'yellow',
123 'ui.prompt': 'yellow',
122 'log.changeset': 'yellow',
124 'log.changeset': 'yellow',
123 'patchbomb.finalsummary': '',
125 'patchbomb.finalsummary': '',
124 'patchbomb.from': 'magenta',
126 'patchbomb.from': 'magenta',
125 'patchbomb.to': 'cyan',
127 'patchbomb.to': 'cyan',
126 'patchbomb.subject': 'green',
128 'patchbomb.subject': 'green',
127 'patchbomb.diffstats': '',
129 'patchbomb.diffstats': '',
128 'rebase.rebased': 'blue',
130 'rebase.rebased': 'blue',
129 'rebase.remaining': 'red bold',
131 'rebase.remaining': 'red bold',
130 'resolve.resolved': 'green bold',
132 'resolve.resolved': 'green bold',
131 'resolve.unresolved': 'red bold',
133 'resolve.unresolved': 'red bold',
132 'shelve.age': 'cyan',
134 'shelve.age': 'cyan',
133 'shelve.newest': 'green bold',
135 'shelve.newest': 'green bold',
134 'shelve.name': 'blue bold',
136 'shelve.name': 'blue bold',
135 'status.added': 'green bold',
137 'status.added': 'green bold',
136 'status.clean': 'none',
138 'status.clean': 'none',
137 'status.copied': 'none',
139 'status.copied': 'none',
138 'status.deleted': 'cyan bold underline',
140 'status.deleted': 'cyan bold underline',
139 'status.ignored': 'black bold',
141 'status.ignored': 'black bold',
140 'status.modified': 'blue bold',
142 'status.modified': 'blue bold',
141 'status.removed': 'red bold',
143 'status.removed': 'red bold',
142 'status.unknown': 'magenta bold underline',
144 'status.unknown': 'magenta bold underline',
143 'tags.normal': 'green',
145 'tags.normal': 'green',
144 'tags.local': 'black bold',
146 'tags.local': 'black bold',
145 }
147 }
146
148
147 def loadcolortable(ui, extname, colortable):
149 def loadcolortable(ui, extname, colortable):
148 _defaultstyles.update(colortable)
150 _defaultstyles.update(colortable)
149
151
150 def _terminfosetup(ui, mode, formatted):
152 def _terminfosetup(ui, mode, formatted):
151 '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
153 '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
152
154
153 # If we failed to load curses, we go ahead and return.
155 # If we failed to load curses, we go ahead and return.
154 if curses is None:
156 if curses is None:
155 return
157 return
156 # Otherwise, see what the config file says.
158 # Otherwise, see what the config file says.
157 if mode not in ('auto', 'terminfo'):
159 if mode not in ('auto', 'terminfo'):
158 return
160 return
159 ui._terminfoparams.update(_baseterminfoparams)
161 ui._terminfoparams.update(_baseterminfoparams)
160
162
161 for key, val in ui.configitems('color'):
163 for key, val in ui.configitems('color'):
162 if key.startswith('color.'):
164 if key.startswith('color.'):
163 newval = (False, int(val), '')
165 newval = (False, int(val), '')
164 ui._terminfoparams[key[6:]] = newval
166 ui._terminfoparams[key[6:]] = newval
165 elif key.startswith('terminfo.'):
167 elif key.startswith('terminfo.'):
166 newval = (True, '', val.replace('\\E', '\x1b'))
168 newval = (True, '', val.replace('\\E', '\x1b'))
167 ui._terminfoparams[key[9:]] = newval
169 ui._terminfoparams[key[9:]] = newval
168 try:
170 try:
169 curses.setupterm()
171 curses.setupterm()
170 except curses.error as e:
172 except curses.error as e:
171 ui._terminfoparams.clear()
173 ui._terminfoparams.clear()
172 return
174 return
173
175
174 for key, (b, e, c) in ui._terminfoparams.copy().items():
176 for key, (b, e, c) in ui._terminfoparams.copy().items():
175 if not b:
177 if not b:
176 continue
178 continue
177 if not c and not curses.tigetstr(pycompat.sysstr(e)):
179 if not c and not curses.tigetstr(pycompat.sysstr(e)):
178 # Most terminals don't support dim, invis, etc, so don't be
180 # Most terminals don't support dim, invis, etc, so don't be
179 # noisy and use ui.debug().
181 # noisy and use ui.debug().
180 ui.debug("no terminfo entry for %s\n" % e)
182 ui.debug("no terminfo entry for %s\n" % e)
181 del ui._terminfoparams[key]
183 del ui._terminfoparams[key]
182 if not curses.tigetstr(r'setaf') or not curses.tigetstr(r'setab'):
184 if not curses.tigetstr(r'setaf') or not curses.tigetstr(r'setab'):
183 # Only warn about missing terminfo entries if we explicitly asked for
185 # Only warn about missing terminfo entries if we explicitly asked for
184 # terminfo mode and we're in a formatted terminal.
186 # terminfo mode and we're in a formatted terminal.
185 if mode == "terminfo" and formatted:
187 if mode == "terminfo" and formatted:
186 ui.warn(_("no terminfo entry for setab/setaf: reverting to "
188 ui.warn(_("no terminfo entry for setab/setaf: reverting to "
187 "ECMA-48 color\n"))
189 "ECMA-48 color\n"))
188 ui._terminfoparams.clear()
190 ui._terminfoparams.clear()
189
191
190 def setup(ui):
192 def setup(ui):
191 """configure color on a ui
193 """configure color on a ui
192
194
193 That function both set the colormode for the ui object and read
195 That function both set the colormode for the ui object and read
194 the configuration looking for custom colors and effect definitions."""
196 the configuration looking for custom colors and effect definitions."""
195 mode = _modesetup(ui)
197 mode = _modesetup(ui)
196 ui._colormode = mode
198 ui._colormode = mode
197 if mode and mode != 'debug':
199 if mode and mode != 'debug':
198 configstyles(ui)
200 configstyles(ui)
199
201
200 def _modesetup(ui):
202 def _modesetup(ui):
201 if ui.plain('color'):
203 if ui.plain('color'):
202 return None
204 return None
203 config = ui.config('ui', 'color')
205 config = ui.config('ui', 'color')
204 if config == 'debug':
206 if config == 'debug':
205 return 'debug'
207 return 'debug'
206
208
207 auto = (config == 'auto')
209 auto = (config == 'auto')
208 always = False
210 always = False
209 if not auto and stringutil.parsebool(config):
211 if not auto and stringutil.parsebool(config):
210 # We want the config to behave like a boolean, "on" is actually auto,
212 # We want the config to behave like a boolean, "on" is actually auto,
211 # but "always" value is treated as a special case to reduce confusion.
213 # but "always" value is treated as a special case to reduce confusion.
212 if ui.configsource('ui', 'color') == '--color' or config == 'always':
214 if ui.configsource('ui', 'color') == '--color' or config == 'always':
213 always = True
215 always = True
214 else:
216 else:
215 auto = True
217 auto = True
216
218
217 if not always and not auto:
219 if not always and not auto:
218 return None
220 return None
219
221
220 formatted = (always or (encoding.environ.get('TERM') != 'dumb'
222 formatted = (always or (encoding.environ.get('TERM') != 'dumb'
221 and ui.formatted()))
223 and ui.formatted()))
222
224
223 mode = ui.config('color', 'mode')
225 mode = ui.config('color', 'mode')
224
226
225 # If pager is active, color.pagermode overrides color.mode.
227 # If pager is active, color.pagermode overrides color.mode.
226 if getattr(ui, 'pageractive', False):
228 if getattr(ui, 'pageractive', False):
227 mode = ui.config('color', 'pagermode', mode)
229 mode = ui.config('color', 'pagermode', mode)
228
230
229 realmode = mode
231 realmode = mode
230 if pycompat.iswindows:
232 if pycompat.iswindows:
231 from . import win32
233 from . import win32
232
234
233 term = encoding.environ.get('TERM')
235 term = encoding.environ.get('TERM')
234 # TERM won't be defined in a vanilla cmd.exe environment.
236 # TERM won't be defined in a vanilla cmd.exe environment.
235
237
236 # UNIX-like environments on Windows such as Cygwin and MSYS will
238 # UNIX-like environments on Windows such as Cygwin and MSYS will
237 # set TERM. They appear to make a best effort attempt at setting it
239 # set TERM. They appear to make a best effort attempt at setting it
238 # to something appropriate. However, not all environments with TERM
240 # to something appropriate. However, not all environments with TERM
239 # defined support ANSI.
241 # defined support ANSI.
240 ansienviron = term and 'xterm' in term
242 ansienviron = term and 'xterm' in term
241
243
242 if mode == 'auto':
244 if mode == 'auto':
243 # Since "ansi" could result in terminal gibberish, we error on the
245 # Since "ansi" could result in terminal gibberish, we error on the
244 # side of selecting "win32". However, if w32effects is not defined,
246 # side of selecting "win32". However, if w32effects is not defined,
245 # we almost certainly don't support "win32", so don't even try.
247 # we almost certainly don't support "win32", so don't even try.
246 # w32ffects is not populated when stdout is redirected, so checking
248 # w32ffects is not populated when stdout is redirected, so checking
247 # it first avoids win32 calls in a state known to error out.
249 # it first avoids win32 calls in a state known to error out.
248 if ansienviron or not w32effects or win32.enablevtmode():
250 if ansienviron or not w32effects or win32.enablevtmode():
249 realmode = 'ansi'
251 realmode = 'ansi'
250 else:
252 else:
251 realmode = 'win32'
253 realmode = 'win32'
252 # An empty w32effects is a clue that stdout is redirected, and thus
254 # An empty w32effects is a clue that stdout is redirected, and thus
253 # cannot enable VT mode.
255 # cannot enable VT mode.
254 elif mode == 'ansi' and w32effects and not ansienviron:
256 elif mode == 'ansi' and w32effects and not ansienviron:
255 win32.enablevtmode()
257 win32.enablevtmode()
256 elif mode == 'auto':
258 elif mode == 'auto':
257 realmode = 'ansi'
259 realmode = 'ansi'
258
260
259 def modewarn():
261 def modewarn():
260 # only warn if color.mode was explicitly set and we're in
262 # only warn if color.mode was explicitly set and we're in
261 # a formatted terminal
263 # a formatted terminal
262 if mode == realmode and formatted:
264 if mode == realmode and formatted:
263 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
265 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
264
266
265 if realmode == 'win32':
267 if realmode == 'win32':
266 ui._terminfoparams.clear()
268 ui._terminfoparams.clear()
267 if not w32effects:
269 if not w32effects:
268 modewarn()
270 modewarn()
269 return None
271 return None
270 elif realmode == 'ansi':
272 elif realmode == 'ansi':
271 ui._terminfoparams.clear()
273 ui._terminfoparams.clear()
272 elif realmode == 'terminfo':
274 elif realmode == 'terminfo':
273 _terminfosetup(ui, mode, formatted)
275 _terminfosetup(ui, mode, formatted)
274 if not ui._terminfoparams:
276 if not ui._terminfoparams:
275 ## FIXME Shouldn't we return None in this case too?
277 ## FIXME Shouldn't we return None in this case too?
276 modewarn()
278 modewarn()
277 realmode = 'ansi'
279 realmode = 'ansi'
278 else:
280 else:
279 return None
281 return None
280
282
281 if always or (auto and formatted):
283 if always or (auto and formatted):
282 return realmode
284 return realmode
283 return None
285 return None
284
286
285 def configstyles(ui):
287 def configstyles(ui):
286 ui._styles.update(_defaultstyles)
288 ui._styles.update(_defaultstyles)
287 for status, cfgeffects in ui.configitems('color'):
289 for status, cfgeffects in ui.configitems('color'):
288 if '.' not in status or status.startswith(('color.', 'terminfo.')):
290 if '.' not in status or status.startswith(('color.', 'terminfo.')):
289 continue
291 continue
290 cfgeffects = ui.configlist('color', status)
292 cfgeffects = ui.configlist('color', status)
291 if cfgeffects:
293 if cfgeffects:
292 good = []
294 good = []
293 for e in cfgeffects:
295 for e in cfgeffects:
294 if valideffect(ui, e):
296 if valideffect(ui, e):
295 good.append(e)
297 good.append(e)
296 else:
298 else:
297 ui.warn(_("ignoring unknown color/effect %r "
299 ui.warn(_("ignoring unknown color/effect %r "
298 "(configured in color.%s)\n")
300 "(configured in color.%s)\n")
299 % (e, status))
301 % (e, status))
300 ui._styles[status] = ' '.join(good)
302 ui._styles[status] = ' '.join(good)
301
303
302 def _activeeffects(ui):
304 def _activeeffects(ui):
303 '''Return the effects map for the color mode set on the ui.'''
305 '''Return the effects map for the color mode set on the ui.'''
304 if ui._colormode == 'win32':
306 if ui._colormode == 'win32':
305 return w32effects
307 return w32effects
306 elif ui._colormode is not None:
308 elif ui._colormode is not None:
307 return _effects
309 return _effects
308 return {}
310 return {}
309
311
310 def valideffect(ui, effect):
312 def valideffect(ui, effect):
311 'Determine if the effect is valid or not.'
313 'Determine if the effect is valid or not.'
312 return ((not ui._terminfoparams and effect in _activeeffects(ui))
314 return ((not ui._terminfoparams and effect in _activeeffects(ui))
313 or (effect in ui._terminfoparams
315 or (effect in ui._terminfoparams
314 or effect[:-11] in ui._terminfoparams))
316 or effect[:-11] in ui._terminfoparams))
315
317
316 def _effect_str(ui, effect):
318 def _effect_str(ui, effect):
317 '''Helper function for render_effects().'''
319 '''Helper function for render_effects().'''
318
320
319 bg = False
321 bg = False
320 if effect.endswith('_background'):
322 if effect.endswith('_background'):
321 bg = True
323 bg = True
322 effect = effect[:-11]
324 effect = effect[:-11]
323 try:
325 try:
324 attr, val, termcode = ui._terminfoparams[effect]
326 attr, val, termcode = ui._terminfoparams[effect]
325 except KeyError:
327 except KeyError:
326 return ''
328 return ''
327 if attr:
329 if attr:
328 if termcode:
330 if termcode:
329 return termcode
331 return termcode
330 else:
332 else:
331 return curses.tigetstr(pycompat.sysstr(val))
333 return curses.tigetstr(pycompat.sysstr(val))
332 elif bg:
334 elif bg:
333 return curses.tparm(curses.tigetstr(r'setab'), val)
335 return curses.tparm(curses.tigetstr(r'setab'), val)
334 else:
336 else:
335 return curses.tparm(curses.tigetstr(r'setaf'), val)
337 return curses.tparm(curses.tigetstr(r'setaf'), val)
336
338
337 def _mergeeffects(text, start, stop):
339 def _mergeeffects(text, start, stop):
338 """Insert start sequence at every occurrence of stop sequence
340 """Insert start sequence at every occurrence of stop sequence
339
341
340 >>> s = _mergeeffects(b'cyan', b'[C]', b'|')
342 >>> s = _mergeeffects(b'cyan', b'[C]', b'|')
341 >>> s = _mergeeffects(s + b'yellow', b'[Y]', b'|')
343 >>> s = _mergeeffects(s + b'yellow', b'[Y]', b'|')
342 >>> s = _mergeeffects(b'ma' + s + b'genta', b'[M]', b'|')
344 >>> s = _mergeeffects(b'ma' + s + b'genta', b'[M]', b'|')
343 >>> s = _mergeeffects(b'red' + s, b'[R]', b'|')
345 >>> s = _mergeeffects(b'red' + s, b'[R]', b'|')
344 >>> s
346 >>> s
345 '[R]red[M]ma[Y][C]cyan|[R][M][Y]yellow|[R][M]genta|'
347 '[R]red[M]ma[Y][C]cyan|[R][M][Y]yellow|[R][M]genta|'
346 """
348 """
347 parts = []
349 parts = []
348 for t in text.split(stop):
350 for t in text.split(stop):
349 if not t:
351 if not t:
350 continue
352 continue
351 parts.extend([start, t, stop])
353 parts.extend([start, t, stop])
352 return ''.join(parts)
354 return ''.join(parts)
353
355
354 def _render_effects(ui, text, effects):
356 def _render_effects(ui, text, effects):
355 'Wrap text in commands to turn on each effect.'
357 'Wrap text in commands to turn on each effect.'
356 if not text:
358 if not text:
357 return text
359 return text
358 if ui._terminfoparams:
360 if ui._terminfoparams:
359 start = ''.join(_effect_str(ui, effect)
361 start = ''.join(_effect_str(ui, effect)
360 for effect in ['none'] + effects.split())
362 for effect in ['none'] + effects.split())
361 stop = _effect_str(ui, 'none')
363 stop = _effect_str(ui, 'none')
362 else:
364 else:
363 activeeffects = _activeeffects(ui)
365 activeeffects = _activeeffects(ui)
364 start = [pycompat.bytestr(activeeffects[e])
366 start = [pycompat.bytestr(activeeffects[e])
365 for e in ['none'] + effects.split()]
367 for e in ['none'] + effects.split()]
366 start = '\033[' + ';'.join(start) + 'm'
368 start = '\033[' + ';'.join(start) + 'm'
367 stop = '\033[' + pycompat.bytestr(activeeffects['none']) + 'm'
369 stop = '\033[' + pycompat.bytestr(activeeffects['none']) + 'm'
368 return _mergeeffects(text, start, stop)
370 return _mergeeffects(text, start, stop)
369
371
370 _ansieffectre = re.compile(br'\x1b\[[0-9;]*m')
372 _ansieffectre = re.compile(br'\x1b\[[0-9;]*m')
371
373
372 def stripeffects(text):
374 def stripeffects(text):
373 """Strip ANSI control codes which could be inserted by colorlabel()"""
375 """Strip ANSI control codes which could be inserted by colorlabel()"""
374 return _ansieffectre.sub('', text)
376 return _ansieffectre.sub('', text)
375
377
376 def colorlabel(ui, msg, label):
378 def colorlabel(ui, msg, label):
377 """add color control code according to the mode"""
379 """add color control code according to the mode"""
378 if ui._colormode == 'debug':
380 if ui._colormode == 'debug':
379 if label and msg:
381 if label and msg:
380 if msg.endswith('\n'):
382 if msg.endswith('\n'):
381 msg = "[%s|%s]\n" % (label, msg[:-1])
383 msg = "[%s|%s]\n" % (label, msg[:-1])
382 else:
384 else:
383 msg = "[%s|%s]" % (label, msg)
385 msg = "[%s|%s]" % (label, msg)
384 elif ui._colormode is not None:
386 elif ui._colormode is not None:
385 effects = []
387 effects = []
386 for l in label.split():
388 for l in label.split():
387 s = ui._styles.get(l, '')
389 s = ui._styles.get(l, '')
388 if s:
390 if s:
389 effects.append(s)
391 effects.append(s)
390 elif valideffect(ui, l):
392 elif valideffect(ui, l):
391 effects.append(l)
393 effects.append(l)
392 effects = ' '.join(effects)
394 effects = ' '.join(effects)
393 if effects:
395 if effects:
394 msg = '\n'.join([_render_effects(ui, line, effects)
396 msg = '\n'.join([_render_effects(ui, line, effects)
395 for line in msg.split('\n')])
397 for line in msg.split('\n')])
396 return msg
398 return msg
397
399
398 w32effects = None
400 w32effects = None
399 if pycompat.iswindows:
401 if pycompat.iswindows:
400 import ctypes
402 import ctypes
401
403
402 _kernel32 = ctypes.windll.kernel32
404 _kernel32 = ctypes.windll.kernel32
403
405
404 _WORD = ctypes.c_ushort
406 _WORD = ctypes.c_ushort
405
407
406 _INVALID_HANDLE_VALUE = -1
408 _INVALID_HANDLE_VALUE = -1
407
409
408 class _COORD(ctypes.Structure):
410 class _COORD(ctypes.Structure):
409 _fields_ = [('X', ctypes.c_short),
411 _fields_ = [('X', ctypes.c_short),
410 ('Y', ctypes.c_short)]
412 ('Y', ctypes.c_short)]
411
413
412 class _SMALL_RECT(ctypes.Structure):
414 class _SMALL_RECT(ctypes.Structure):
413 _fields_ = [('Left', ctypes.c_short),
415 _fields_ = [('Left', ctypes.c_short),
414 ('Top', ctypes.c_short),
416 ('Top', ctypes.c_short),
415 ('Right', ctypes.c_short),
417 ('Right', ctypes.c_short),
416 ('Bottom', ctypes.c_short)]
418 ('Bottom', ctypes.c_short)]
417
419
418 class _CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure):
420 class _CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure):
419 _fields_ = [('dwSize', _COORD),
421 _fields_ = [('dwSize', _COORD),
420 ('dwCursorPosition', _COORD),
422 ('dwCursorPosition', _COORD),
421 ('wAttributes', _WORD),
423 ('wAttributes', _WORD),
422 ('srWindow', _SMALL_RECT),
424 ('srWindow', _SMALL_RECT),
423 ('dwMaximumWindowSize', _COORD)]
425 ('dwMaximumWindowSize', _COORD)]
424
426
425 _STD_OUTPUT_HANDLE = 0xfffffff5 # (DWORD)-11
427 _STD_OUTPUT_HANDLE = 0xfffffff5 # (DWORD)-11
426 _STD_ERROR_HANDLE = 0xfffffff4 # (DWORD)-12
428 _STD_ERROR_HANDLE = 0xfffffff4 # (DWORD)-12
427
429
428 _FOREGROUND_BLUE = 0x0001
430 _FOREGROUND_BLUE = 0x0001
429 _FOREGROUND_GREEN = 0x0002
431 _FOREGROUND_GREEN = 0x0002
430 _FOREGROUND_RED = 0x0004
432 _FOREGROUND_RED = 0x0004
431 _FOREGROUND_INTENSITY = 0x0008
433 _FOREGROUND_INTENSITY = 0x0008
432
434
433 _BACKGROUND_BLUE = 0x0010
435 _BACKGROUND_BLUE = 0x0010
434 _BACKGROUND_GREEN = 0x0020
436 _BACKGROUND_GREEN = 0x0020
435 _BACKGROUND_RED = 0x0040
437 _BACKGROUND_RED = 0x0040
436 _BACKGROUND_INTENSITY = 0x0080
438 _BACKGROUND_INTENSITY = 0x0080
437
439
438 _COMMON_LVB_REVERSE_VIDEO = 0x4000
440 _COMMON_LVB_REVERSE_VIDEO = 0x4000
439 _COMMON_LVB_UNDERSCORE = 0x8000
441 _COMMON_LVB_UNDERSCORE = 0x8000
440
442
441 # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx
443 # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx
442 w32effects = {
444 w32effects = {
443 'none': -1,
445 'none': -1,
444 'black': 0,
446 'black': 0,
445 'red': _FOREGROUND_RED,
447 'red': _FOREGROUND_RED,
446 'green': _FOREGROUND_GREEN,
448 'green': _FOREGROUND_GREEN,
447 'yellow': _FOREGROUND_RED | _FOREGROUND_GREEN,
449 'yellow': _FOREGROUND_RED | _FOREGROUND_GREEN,
448 'blue': _FOREGROUND_BLUE,
450 'blue': _FOREGROUND_BLUE,
449 'magenta': _FOREGROUND_BLUE | _FOREGROUND_RED,
451 'magenta': _FOREGROUND_BLUE | _FOREGROUND_RED,
450 'cyan': _FOREGROUND_BLUE | _FOREGROUND_GREEN,
452 'cyan': _FOREGROUND_BLUE | _FOREGROUND_GREEN,
451 'white': _FOREGROUND_RED | _FOREGROUND_GREEN | _FOREGROUND_BLUE,
453 'white': _FOREGROUND_RED | _FOREGROUND_GREEN | _FOREGROUND_BLUE,
452 'bold': _FOREGROUND_INTENSITY,
454 'bold': _FOREGROUND_INTENSITY,
453 'black_background': 0x100, # unused value > 0x0f
455 'black_background': 0x100, # unused value > 0x0f
454 'red_background': _BACKGROUND_RED,
456 'red_background': _BACKGROUND_RED,
455 'green_background': _BACKGROUND_GREEN,
457 'green_background': _BACKGROUND_GREEN,
456 'yellow_background': _BACKGROUND_RED | _BACKGROUND_GREEN,
458 'yellow_background': _BACKGROUND_RED | _BACKGROUND_GREEN,
457 'blue_background': _BACKGROUND_BLUE,
459 'blue_background': _BACKGROUND_BLUE,
458 'purple_background': _BACKGROUND_BLUE | _BACKGROUND_RED,
460 'purple_background': _BACKGROUND_BLUE | _BACKGROUND_RED,
459 'cyan_background': _BACKGROUND_BLUE | _BACKGROUND_GREEN,
461 'cyan_background': _BACKGROUND_BLUE | _BACKGROUND_GREEN,
460 'white_background': (_BACKGROUND_RED | _BACKGROUND_GREEN |
462 'white_background': (_BACKGROUND_RED | _BACKGROUND_GREEN |
461 _BACKGROUND_BLUE),
463 _BACKGROUND_BLUE),
462 'bold_background': _BACKGROUND_INTENSITY,
464 'bold_background': _BACKGROUND_INTENSITY,
463 'underline': _COMMON_LVB_UNDERSCORE, # double-byte charsets only
465 'underline': _COMMON_LVB_UNDERSCORE, # double-byte charsets only
464 'inverse': _COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only
466 'inverse': _COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only
465 }
467 }
466
468
467 passthrough = {_FOREGROUND_INTENSITY,
469 passthrough = {_FOREGROUND_INTENSITY,
468 _BACKGROUND_INTENSITY,
470 _BACKGROUND_INTENSITY,
469 _COMMON_LVB_UNDERSCORE,
471 _COMMON_LVB_UNDERSCORE,
470 _COMMON_LVB_REVERSE_VIDEO}
472 _COMMON_LVB_REVERSE_VIDEO}
471
473
472 stdout = _kernel32.GetStdHandle(
474 stdout = _kernel32.GetStdHandle(
473 _STD_OUTPUT_HANDLE) # don't close the handle returned
475 _STD_OUTPUT_HANDLE) # don't close the handle returned
474 if stdout is None or stdout == _INVALID_HANDLE_VALUE:
476 if stdout is None or stdout == _INVALID_HANDLE_VALUE:
475 w32effects = None
477 w32effects = None
476 else:
478 else:
477 csbi = _CONSOLE_SCREEN_BUFFER_INFO()
479 csbi = _CONSOLE_SCREEN_BUFFER_INFO()
478 if not _kernel32.GetConsoleScreenBufferInfo(
480 if not _kernel32.GetConsoleScreenBufferInfo(
479 stdout, ctypes.byref(csbi)):
481 stdout, ctypes.byref(csbi)):
480 # stdout may not support GetConsoleScreenBufferInfo()
482 # stdout may not support GetConsoleScreenBufferInfo()
481 # when called from subprocess or redirected
483 # when called from subprocess or redirected
482 w32effects = None
484 w32effects = None
483 else:
485 else:
484 origattr = csbi.wAttributes
486 origattr = csbi.wAttributes
485 ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
487 ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
486 re.MULTILINE | re.DOTALL)
488 re.MULTILINE | re.DOTALL)
487
489
488 def win32print(ui, writefunc, *msgs, **opts):
490 def win32print(ui, writefunc, *msgs, **opts):
489 for text in msgs:
491 for text in msgs:
490 _win32print(ui, text, writefunc, **opts)
492 _win32print(ui, text, writefunc, **opts)
491
493
492 def _win32print(ui, text, writefunc, **opts):
494 def _win32print(ui, text, writefunc, **opts):
493 label = opts.get(r'label', '')
495 label = opts.get(r'label', '')
494 attr = origattr
496 attr = origattr
495
497
496 def mapcolor(val, attr):
498 def mapcolor(val, attr):
497 if val == -1:
499 if val == -1:
498 return origattr
500 return origattr
499 elif val in passthrough:
501 elif val in passthrough:
500 return attr | val
502 return attr | val
501 elif val > 0x0f:
503 elif val > 0x0f:
502 return (val & 0x70) | (attr & 0x8f)
504 return (val & 0x70) | (attr & 0x8f)
503 else:
505 else:
504 return (val & 0x07) | (attr & 0xf8)
506 return (val & 0x07) | (attr & 0xf8)
505
507
506 # determine console attributes based on labels
508 # determine console attributes based on labels
507 for l in label.split():
509 for l in label.split():
508 style = ui._styles.get(l, '')
510 style = ui._styles.get(l, '')
509 for effect in style.split():
511 for effect in style.split():
510 try:
512 try:
511 attr = mapcolor(w32effects[effect], attr)
513 attr = mapcolor(w32effects[effect], attr)
512 except KeyError:
514 except KeyError:
513 # w32effects could not have certain attributes so we skip
515 # w32effects could not have certain attributes so we skip
514 # them if not found
516 # them if not found
515 pass
517 pass
516 # hack to ensure regexp finds data
518 # hack to ensure regexp finds data
517 if not text.startswith('\033['):
519 if not text.startswith('\033['):
518 text = '\033[m' + text
520 text = '\033[m' + text
519
521
520 # Look for ANSI-like codes embedded in text
522 # Look for ANSI-like codes embedded in text
521 m = re.match(ansire, text)
523 m = re.match(ansire, text)
522
524
523 try:
525 try:
524 while m:
526 while m:
525 for sattr in m.group(1).split(';'):
527 for sattr in m.group(1).split(';'):
526 if sattr:
528 if sattr:
527 attr = mapcolor(int(sattr), attr)
529 attr = mapcolor(int(sattr), attr)
528 ui.flush()
530 ui.flush()
529 _kernel32.SetConsoleTextAttribute(stdout, attr)
531 _kernel32.SetConsoleTextAttribute(stdout, attr)
530 writefunc(m.group(2), **opts)
532 writefunc(m.group(2), **opts)
531 m = re.match(ansire, m.group(3))
533 m = re.match(ansire, m.group(3))
532 finally:
534 finally:
533 # Explicitly reset original attributes
535 # Explicitly reset original attributes
534 ui.flush()
536 ui.flush()
535 _kernel32.SetConsoleTextAttribute(stdout, origattr)
537 _kernel32.SetConsoleTextAttribute(stdout, origattr)
@@ -1,416 +1,416 b''
1 Setup
1 Setup
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
4 > [ui]
5 > color = yes
5 > color = yes
6 > formatted = always
6 > formatted = always
7 > paginate = never
7 > paginate = never
8 > [color]
8 > [color]
9 > mode = ansi
9 > mode = ansi
10 > EOF
10 > EOF
11 $ hg init repo
11 $ hg init repo
12 $ cd repo
12 $ cd repo
13 $ cat > a <<EOF
13 $ cat > a <<EOF
14 > c
14 > c
15 > c
15 > c
16 > a
16 > a
17 > a
17 > a
18 > b
18 > b
19 > a
19 > a
20 > a
20 > a
21 > c
21 > c
22 > c
22 > c
23 > EOF
23 > EOF
24 $ hg ci -Am adda
24 $ hg ci -Am adda
25 adding a
25 \x1b[0;32madding a\x1b[0m (esc)
26 $ cat > a <<EOF
26 $ cat > a <<EOF
27 > c
27 > c
28 > c
28 > c
29 > a
29 > a
30 > a
30 > a
31 > dd
31 > dd
32 > a
32 > a
33 > a
33 > a
34 > c
34 > c
35 > c
35 > c
36 > EOF
36 > EOF
37
37
38 default context
38 default context
39
39
40 $ hg diff --nodates
40 $ hg diff --nodates
41 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
41 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
42 \x1b[0;31;1m--- a/a\x1b[0m (esc)
42 \x1b[0;31;1m--- a/a\x1b[0m (esc)
43 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
43 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
44 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
44 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
45 c
45 c
46 a
46 a
47 a
47 a
48 \x1b[0;31m-b\x1b[0m (esc)
48 \x1b[0;31m-b\x1b[0m (esc)
49 \x1b[0;32m+dd\x1b[0m (esc)
49 \x1b[0;32m+dd\x1b[0m (esc)
50 a
50 a
51 a
51 a
52 c
52 c
53
53
54 trailing whitespace
54 trailing whitespace
55
55
56 $ cp a a.orig
56 $ cp a a.orig
57 >>> with open('a', 'rb') as f:
57 >>> with open('a', 'rb') as f:
58 ... data = f.read()
58 ... data = f.read()
59 >>> with open('a', 'wb') as f:
59 >>> with open('a', 'wb') as f:
60 ... f.write(data.replace('dd', 'dd \r'))
60 ... f.write(data.replace('dd', 'dd \r'))
61 $ hg diff --nodates
61 $ hg diff --nodates
62 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
62 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
63 \x1b[0;31;1m--- a/a\x1b[0m (esc)
63 \x1b[0;31;1m--- a/a\x1b[0m (esc)
64 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
64 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
65 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
65 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
66 c
66 c
67 a
67 a
68 a
68 a
69 \x1b[0;31m-b\x1b[0m (esc)
69 \x1b[0;31m-b\x1b[0m (esc)
70 \x1b[0;32m+dd\x1b[0m\x1b[0;1;41m \x1b[0m\r (esc)
70 \x1b[0;32m+dd\x1b[0m\x1b[0;1;41m \x1b[0m\r (esc)
71 a
71 a
72 a
72 a
73 c
73 c
74
74
75 $ mv a.orig a
75 $ mv a.orig a
76
76
77 (check that 'ui.color=yes' match '--color=auto')
77 (check that 'ui.color=yes' match '--color=auto')
78
78
79 $ hg diff --nodates --config ui.formatted=no
79 $ hg diff --nodates --config ui.formatted=no
80 diff -r cf9f4ba66af2 a
80 diff -r cf9f4ba66af2 a
81 --- a/a
81 --- a/a
82 +++ b/a
82 +++ b/a
83 @@ -2,7 +2,7 @@
83 @@ -2,7 +2,7 @@
84 c
84 c
85 a
85 a
86 a
86 a
87 -b
87 -b
88 +dd
88 +dd
89 a
89 a
90 a
90 a
91 c
91 c
92
92
93 (check that 'ui.color=no' disable color)
93 (check that 'ui.color=no' disable color)
94
94
95 $ hg diff --nodates --config ui.formatted=yes --config ui.color=no
95 $ hg diff --nodates --config ui.formatted=yes --config ui.color=no
96 diff -r cf9f4ba66af2 a
96 diff -r cf9f4ba66af2 a
97 --- a/a
97 --- a/a
98 +++ b/a
98 +++ b/a
99 @@ -2,7 +2,7 @@
99 @@ -2,7 +2,7 @@
100 c
100 c
101 a
101 a
102 a
102 a
103 -b
103 -b
104 +dd
104 +dd
105 a
105 a
106 a
106 a
107 c
107 c
108
108
109 (check that 'ui.color=always' force color)
109 (check that 'ui.color=always' force color)
110
110
111 $ hg diff --nodates --config ui.formatted=no --config ui.color=always
111 $ hg diff --nodates --config ui.formatted=no --config ui.color=always
112 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
112 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
113 \x1b[0;31;1m--- a/a\x1b[0m (esc)
113 \x1b[0;31;1m--- a/a\x1b[0m (esc)
114 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
114 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
115 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
115 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
116 c
116 c
117 a
117 a
118 a
118 a
119 \x1b[0;31m-b\x1b[0m (esc)
119 \x1b[0;31m-b\x1b[0m (esc)
120 \x1b[0;32m+dd\x1b[0m (esc)
120 \x1b[0;32m+dd\x1b[0m (esc)
121 a
121 a
122 a
122 a
123 c
123 c
124
124
125 --unified=2
125 --unified=2
126
126
127 $ hg diff --nodates -U 2
127 $ hg diff --nodates -U 2
128 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
128 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
129 \x1b[0;31;1m--- a/a\x1b[0m (esc)
129 \x1b[0;31;1m--- a/a\x1b[0m (esc)
130 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
130 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
131 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
131 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
132 a
132 a
133 a
133 a
134 \x1b[0;31m-b\x1b[0m (esc)
134 \x1b[0;31m-b\x1b[0m (esc)
135 \x1b[0;32m+dd\x1b[0m (esc)
135 \x1b[0;32m+dd\x1b[0m (esc)
136 a
136 a
137 a
137 a
138
138
139 diffstat
139 diffstat
140
140
141 $ hg diff --stat
141 $ hg diff --stat
142 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
142 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
143 1 files changed, 1 insertions(+), 1 deletions(-)
143 1 files changed, 1 insertions(+), 1 deletions(-)
144 $ cat <<EOF >> $HGRCPATH
144 $ cat <<EOF >> $HGRCPATH
145 > [extensions]
145 > [extensions]
146 > record =
146 > record =
147 > [ui]
147 > [ui]
148 > interactive = true
148 > interactive = true
149 > [diff]
149 > [diff]
150 > git = True
150 > git = True
151 > EOF
151 > EOF
152
152
153 #if execbit
153 #if execbit
154
154
155 record
155 record
156
156
157 $ chmod +x a
157 $ chmod +x a
158 $ hg record -m moda a <<EOF
158 $ hg record -m moda a <<EOF
159 > y
159 > y
160 > y
160 > y
161 > EOF
161 > EOF
162 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
162 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
163 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
163 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
164 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
164 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
165 1 hunks, 1 lines changed
165 1 hunks, 1 lines changed
166 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
166 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
167
167
168 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
168 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
169 c
169 c
170 a
170 a
171 a
171 a
172 \x1b[0;31m-b\x1b[0m (esc)
172 \x1b[0;31m-b\x1b[0m (esc)
173 \x1b[0;32m+dd\x1b[0m (esc)
173 \x1b[0;32m+dd\x1b[0m (esc)
174 a
174 a
175 a
175 a
176 c
176 c
177 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
177 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
178
178
179
179
180 $ echo "[extensions]" >> $HGRCPATH
180 $ echo "[extensions]" >> $HGRCPATH
181 $ echo "mq=" >> $HGRCPATH
181 $ echo "mq=" >> $HGRCPATH
182 $ hg rollback
182 $ hg rollback
183 repository tip rolled back to revision 0 (undo commit)
183 repository tip rolled back to revision 0 (undo commit)
184 working directory now based on revision 0
184 working directory now based on revision 0
185
185
186 qrecord
186 qrecord
187
187
188 $ hg qrecord -m moda patch <<EOF
188 $ hg qrecord -m moda patch <<EOF
189 > y
189 > y
190 > y
190 > y
191 > EOF
191 > EOF
192 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
192 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
193 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
193 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
194 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
194 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
195 1 hunks, 1 lines changed
195 1 hunks, 1 lines changed
196 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
196 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
197
197
198 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
198 \x1b[0;35m@@ -2,7 +2,7 @@ c\x1b[0m (esc)
199 c
199 c
200 a
200 a
201 a
201 a
202 \x1b[0;31m-b\x1b[0m (esc)
202 \x1b[0;31m-b\x1b[0m (esc)
203 \x1b[0;32m+dd\x1b[0m (esc)
203 \x1b[0;32m+dd\x1b[0m (esc)
204 a
204 a
205 a
205 a
206 c
206 c
207 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
207 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
208
208
209
209
210 $ hg qpop -a
210 $ hg qpop -a
211 popping patch
211 popping patch
212 patch queue now empty
212 patch queue now empty
213
213
214 #endif
214 #endif
215
215
216 issue3712: test colorization of subrepo diff
216 issue3712: test colorization of subrepo diff
217
217
218 $ hg init sub
218 $ hg init sub
219 $ echo b > sub/b
219 $ echo b > sub/b
220 $ hg -R sub commit -Am 'create sub'
220 $ hg -R sub commit -Am 'create sub'
221 adding b
221 \x1b[0;32madding b\x1b[0m (esc)
222 $ echo 'sub = sub' > .hgsub
222 $ echo 'sub = sub' > .hgsub
223 $ hg add .hgsub
223 $ hg add .hgsub
224 $ hg commit -m 'add subrepo sub'
224 $ hg commit -m 'add subrepo sub'
225 $ echo aa >> a
225 $ echo aa >> a
226 $ echo bb >> sub/b
226 $ echo bb >> sub/b
227
227
228 $ hg diff -S
228 $ hg diff -S
229 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
229 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
230 \x1b[0;31;1m--- a/a\x1b[0m (esc)
230 \x1b[0;31;1m--- a/a\x1b[0m (esc)
231 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
231 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
232 \x1b[0;35m@@ -7,3 +7,4 @@\x1b[0m (esc)
232 \x1b[0;35m@@ -7,3 +7,4 @@\x1b[0m (esc)
233 a
233 a
234 c
234 c
235 c
235 c
236 \x1b[0;32m+aa\x1b[0m (esc)
236 \x1b[0;32m+aa\x1b[0m (esc)
237 \x1b[0;1mdiff --git a/sub/b b/sub/b\x1b[0m (esc)
237 \x1b[0;1mdiff --git a/sub/b b/sub/b\x1b[0m (esc)
238 \x1b[0;31;1m--- a/sub/b\x1b[0m (esc)
238 \x1b[0;31;1m--- a/sub/b\x1b[0m (esc)
239 \x1b[0;32;1m+++ b/sub/b\x1b[0m (esc)
239 \x1b[0;32;1m+++ b/sub/b\x1b[0m (esc)
240 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
240 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
241 b
241 b
242 \x1b[0;32m+bb\x1b[0m (esc)
242 \x1b[0;32m+bb\x1b[0m (esc)
243
243
244 test tabs
244 test tabs
245
245
246 $ cat >> a <<EOF
246 $ cat >> a <<EOF
247 > one tab
247 > one tab
248 > two tabs
248 > two tabs
249 > end tab
249 > end tab
250 > mid tab
250 > mid tab
251 > all tabs
251 > all tabs
252 > EOF
252 > EOF
253 $ hg diff --nodates
253 $ hg diff --nodates
254 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
254 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
255 \x1b[0;31;1m--- a/a\x1b[0m (esc)
255 \x1b[0;31;1m--- a/a\x1b[0m (esc)
256 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
256 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
257 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
257 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
258 a
258 a
259 c
259 c
260 c
260 c
261 \x1b[0;32m+aa\x1b[0m (esc)
261 \x1b[0;32m+aa\x1b[0m (esc)
262 \x1b[0;32m+\x1b[0m \x1b[0;32mone tab\x1b[0m (esc)
262 \x1b[0;32m+\x1b[0m \x1b[0;32mone tab\x1b[0m (esc)
263 \x1b[0;32m+\x1b[0m \x1b[0;32mtwo tabs\x1b[0m (esc)
263 \x1b[0;32m+\x1b[0m \x1b[0;32mtwo tabs\x1b[0m (esc)
264 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
264 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
265 \x1b[0;32m+mid\x1b[0m \x1b[0;32mtab\x1b[0m (esc)
265 \x1b[0;32m+mid\x1b[0m \x1b[0;32mtab\x1b[0m (esc)
266 \x1b[0;32m+\x1b[0m \x1b[0;32mall\x1b[0m \x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
266 \x1b[0;32m+\x1b[0m \x1b[0;32mall\x1b[0m \x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
267 $ echo "[color]" >> $HGRCPATH
267 $ echo "[color]" >> $HGRCPATH
268 $ echo "diff.tab = bold magenta" >> $HGRCPATH
268 $ echo "diff.tab = bold magenta" >> $HGRCPATH
269 $ hg diff --nodates
269 $ hg diff --nodates
270 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
270 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
271 \x1b[0;31;1m--- a/a\x1b[0m (esc)
271 \x1b[0;31;1m--- a/a\x1b[0m (esc)
272 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
272 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
273 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
273 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
274 a
274 a
275 c
275 c
276 c
276 c
277 \x1b[0;32m+aa\x1b[0m (esc)
277 \x1b[0;32m+aa\x1b[0m (esc)
278 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mone tab\x1b[0m (esc)
278 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mone tab\x1b[0m (esc)
279 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtwo tabs\x1b[0m (esc)
279 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtwo tabs\x1b[0m (esc)
280 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
280 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
281 \x1b[0;32m+mid\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtab\x1b[0m (esc)
281 \x1b[0;32m+mid\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtab\x1b[0m (esc)
282 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
282 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
283
283
284 $ cd ..
284 $ cd ..
285
285
286 test inline color diff
286 test inline color diff
287
287
288 $ hg init inline
288 $ hg init inline
289 $ cd inline
289 $ cd inline
290 $ cat > file1 << EOF
290 $ cat > file1 << EOF
291 > this is the first line
291 > this is the first line
292 > this is the second line
292 > this is the second line
293 > third line starts with space
293 > third line starts with space
294 > + starts with a plus sign
294 > + starts with a plus sign
295 > this one with one tab
295 > this one with one tab
296 > now with full two tabs
296 > now with full two tabs
297 > now tabs everywhere, much fun
297 > now tabs everywhere, much fun
298 >
298 >
299 > this line won't change
299 > this line won't change
300 >
300 >
301 > two lines are going to
301 > two lines are going to
302 > be changed into three!
302 > be changed into three!
303 >
303 >
304 > three of those lines will
304 > three of those lines will
305 > collapse onto one
305 > collapse onto one
306 > (to see if it works)
306 > (to see if it works)
307 > EOF
307 > EOF
308 $ hg add file1
308 $ hg add file1
309 $ hg ci -m 'commit'
309 $ hg ci -m 'commit'
310
310
311 $ cat > file1 << EOF
311 $ cat > file1 << EOF
312 > that is the first paragraph
312 > that is the first paragraph
313 > this is the second line
313 > this is the second line
314 > third line starts with space
314 > third line starts with space
315 > - starts with a minus sign
315 > - starts with a minus sign
316 > this one with two tab
316 > this one with two tab
317 > now with full three tabs
317 > now with full three tabs
318 > now there are tabs everywhere, much fun
318 > now there are tabs everywhere, much fun
319 >
319 >
320 > this line won't change
320 > this line won't change
321 >
321 >
322 > two lines are going to
322 > two lines are going to
323 > (entirely magically,
323 > (entirely magically,
324 > assuming this works)
324 > assuming this works)
325 > be changed into four!
325 > be changed into four!
326 >
326 >
327 > three of those lines have
327 > three of those lines have
328 > collapsed onto one
328 > collapsed onto one
329 > EOF
329 > EOF
330 $ hg diff --config diff.word-diff=False --color=debug
330 $ hg diff --config diff.word-diff=False --color=debug
331 [diff.diffline|diff --git a/file1 b/file1]
331 [diff.diffline|diff --git a/file1 b/file1]
332 [diff.file_a|--- a/file1]
332 [diff.file_a|--- a/file1]
333 [diff.file_b|+++ b/file1]
333 [diff.file_b|+++ b/file1]
334 [diff.hunk|@@ -1,16 +1,17 @@]
334 [diff.hunk|@@ -1,16 +1,17 @@]
335 [diff.deleted|-this is the first line]
335 [diff.deleted|-this is the first line]
336 [diff.deleted|-this is the second line]
336 [diff.deleted|-this is the second line]
337 [diff.deleted|- third line starts with space]
337 [diff.deleted|- third line starts with space]
338 [diff.deleted|-+ starts with a plus sign]
338 [diff.deleted|-+ starts with a plus sign]
339 [diff.deleted|-][diff.tab| ][diff.deleted|this one with one tab]
339 [diff.deleted|-][diff.tab| ][diff.deleted|this one with one tab]
340 [diff.deleted|-][diff.tab| ][diff.deleted|now with full two tabs]
340 [diff.deleted|-][diff.tab| ][diff.deleted|now with full two tabs]
341 [diff.deleted|-][diff.tab| ][diff.deleted|now tabs][diff.tab| ][diff.deleted|everywhere, much fun]
341 [diff.deleted|-][diff.tab| ][diff.deleted|now tabs][diff.tab| ][diff.deleted|everywhere, much fun]
342 [diff.inserted|+that is the first paragraph]
342 [diff.inserted|+that is the first paragraph]
343 [diff.inserted|+ this is the second line]
343 [diff.inserted|+ this is the second line]
344 [diff.inserted|+third line starts with space]
344 [diff.inserted|+third line starts with space]
345 [diff.inserted|+- starts with a minus sign]
345 [diff.inserted|+- starts with a minus sign]
346 [diff.inserted|+][diff.tab| ][diff.inserted|this one with two tab]
346 [diff.inserted|+][diff.tab| ][diff.inserted|this one with two tab]
347 [diff.inserted|+][diff.tab| ][diff.inserted|now with full three tabs]
347 [diff.inserted|+][diff.tab| ][diff.inserted|now with full three tabs]
348 [diff.inserted|+][diff.tab| ][diff.inserted|now there are tabs][diff.tab| ][diff.inserted|everywhere, much fun]
348 [diff.inserted|+][diff.tab| ][diff.inserted|now there are tabs][diff.tab| ][diff.inserted|everywhere, much fun]
349
349
350 this line won't change
350 this line won't change
351
351
352 two lines are going to
352 two lines are going to
353 [diff.deleted|-be changed into three!]
353 [diff.deleted|-be changed into three!]
354 [diff.inserted|+(entirely magically,]
354 [diff.inserted|+(entirely magically,]
355 [diff.inserted|+ assuming this works)]
355 [diff.inserted|+ assuming this works)]
356 [diff.inserted|+be changed into four!]
356 [diff.inserted|+be changed into four!]
357
357
358 [diff.deleted|-three of those lines will]
358 [diff.deleted|-three of those lines will]
359 [diff.deleted|-collapse onto one]
359 [diff.deleted|-collapse onto one]
360 [diff.deleted|-(to see if it works)]
360 [diff.deleted|-(to see if it works)]
361 [diff.inserted|+three of those lines have]
361 [diff.inserted|+three of those lines have]
362 [diff.inserted|+collapsed onto one]
362 [diff.inserted|+collapsed onto one]
363 $ hg diff --config diff.word-diff=True --color=debug
363 $ hg diff --config diff.word-diff=True --color=debug
364 [diff.diffline|diff --git a/file1 b/file1]
364 [diff.diffline|diff --git a/file1 b/file1]
365 [diff.file_a|--- a/file1]
365 [diff.file_a|--- a/file1]
366 [diff.file_b|+++ b/file1]
366 [diff.file_b|+++ b/file1]
367 [diff.hunk|@@ -1,16 +1,17 @@]
367 [diff.hunk|@@ -1,16 +1,17 @@]
368 [diff.deleted|-][diff.deleted.changed|this][diff.deleted.unchanged| is the first ][diff.deleted.changed|line]
368 [diff.deleted|-][diff.deleted.changed|this][diff.deleted.unchanged| is the first ][diff.deleted.changed|line]
369 [diff.deleted|-][diff.deleted.unchanged|this is the second line]
369 [diff.deleted|-][diff.deleted.unchanged|this is the second line]
370 [diff.deleted|-][diff.deleted.changed| ][diff.deleted.unchanged|third line starts with space]
370 [diff.deleted|-][diff.deleted.changed| ][diff.deleted.unchanged|third line starts with space]
371 [diff.deleted|-][diff.deleted.changed|+][diff.deleted.unchanged| starts with a ][diff.deleted.changed|plus][diff.deleted.unchanged| sign]
371 [diff.deleted|-][diff.deleted.changed|+][diff.deleted.unchanged| starts with a ][diff.deleted.changed|plus][diff.deleted.unchanged| sign]
372 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|this one with ][diff.deleted.changed|one][diff.deleted.unchanged| tab]
372 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|this one with ][diff.deleted.changed|one][diff.deleted.unchanged| tab]
373 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now with full ][diff.deleted.changed|two][diff.deleted.unchanged| tabs]
373 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now with full ][diff.deleted.changed|two][diff.deleted.unchanged| tabs]
374 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now ][diff.deleted.unchanged|tabs][diff.tab| ][diff.deleted.unchanged|everywhere, much fun]
374 [diff.deleted|-][diff.tab| ][diff.deleted.unchanged|now ][diff.deleted.unchanged|tabs][diff.tab| ][diff.deleted.unchanged|everywhere, much fun]
375 [diff.inserted|+][diff.inserted.changed|that][diff.inserted.unchanged| is the first ][diff.inserted.changed|paragraph]
375 [diff.inserted|+][diff.inserted.changed|that][diff.inserted.unchanged| is the first ][diff.inserted.changed|paragraph]
376 [diff.inserted|+][diff.inserted.changed| ][diff.inserted.unchanged|this is the second line]
376 [diff.inserted|+][diff.inserted.changed| ][diff.inserted.unchanged|this is the second line]
377 [diff.inserted|+][diff.inserted.unchanged|third line starts with space]
377 [diff.inserted|+][diff.inserted.unchanged|third line starts with space]
378 [diff.inserted|+][diff.inserted.changed|-][diff.inserted.unchanged| starts with a ][diff.inserted.changed|minus][diff.inserted.unchanged| sign]
378 [diff.inserted|+][diff.inserted.changed|-][diff.inserted.unchanged| starts with a ][diff.inserted.changed|minus][diff.inserted.unchanged| sign]
379 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|this one with ][diff.inserted.changed|two][diff.inserted.unchanged| tab]
379 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|this one with ][diff.inserted.changed|two][diff.inserted.unchanged| tab]
380 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now with full ][diff.inserted.changed|three][diff.inserted.unchanged| tabs]
380 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now with full ][diff.inserted.changed|three][diff.inserted.unchanged| tabs]
381 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now ][diff.inserted.changed|there are ][diff.inserted.unchanged|tabs][diff.tab| ][diff.inserted.unchanged|everywhere, much fun]
381 [diff.inserted|+][diff.tab| ][diff.inserted.unchanged|now ][diff.inserted.changed|there are ][diff.inserted.unchanged|tabs][diff.tab| ][diff.inserted.unchanged|everywhere, much fun]
382
382
383 this line won't change
383 this line won't change
384
384
385 two lines are going to
385 two lines are going to
386 [diff.deleted|-][diff.deleted.unchanged|be changed into ][diff.deleted.changed|three][diff.deleted.unchanged|!]
386 [diff.deleted|-][diff.deleted.unchanged|be changed into ][diff.deleted.changed|three][diff.deleted.unchanged|!]
387 [diff.inserted|+][diff.inserted.changed|(entirely magically,]
387 [diff.inserted|+][diff.inserted.changed|(entirely magically,]
388 [diff.inserted|+][diff.inserted.changed| assuming this works)]
388 [diff.inserted|+][diff.inserted.changed| assuming this works)]
389 [diff.inserted|+][diff.inserted.unchanged|be changed into ][diff.inserted.changed|four][diff.inserted.unchanged|!]
389 [diff.inserted|+][diff.inserted.unchanged|be changed into ][diff.inserted.changed|four][diff.inserted.unchanged|!]
390
390
391 [diff.deleted|-][diff.deleted.unchanged|three of those lines ][diff.deleted.changed|will]
391 [diff.deleted|-][diff.deleted.unchanged|three of those lines ][diff.deleted.changed|will]
392 [diff.deleted|-][diff.deleted.changed|collapse][diff.deleted.unchanged| onto one]
392 [diff.deleted|-][diff.deleted.changed|collapse][diff.deleted.unchanged| onto one]
393 [diff.deleted|-][diff.deleted.changed|(to see if it works)]
393 [diff.deleted|-][diff.deleted.changed|(to see if it works)]
394 [diff.inserted|+][diff.inserted.unchanged|three of those lines ][diff.inserted.changed|have]
394 [diff.inserted|+][diff.inserted.unchanged|three of those lines ][diff.inserted.changed|have]
395 [diff.inserted|+][diff.inserted.changed|collapsed][diff.inserted.unchanged| onto one]
395 [diff.inserted|+][diff.inserted.changed|collapsed][diff.inserted.unchanged| onto one]
396
396
397 multibyte character shouldn't be broken up in word diff:
397 multibyte character shouldn't be broken up in word diff:
398
398
399 $ $PYTHON <<'EOF'
399 $ $PYTHON <<'EOF'
400 > with open("utf8", "wb") as f:
400 > with open("utf8", "wb") as f:
401 > f.write(b"blah \xe3\x82\xa2 blah\n")
401 > f.write(b"blah \xe3\x82\xa2 blah\n")
402 > EOF
402 > EOF
403 $ hg ci -Am 'add utf8 char' utf8
403 $ hg ci -Am 'add utf8 char' utf8
404 $ $PYTHON <<'EOF'
404 $ $PYTHON <<'EOF'
405 > with open("utf8", "wb") as f:
405 > with open("utf8", "wb") as f:
406 > f.write(b"blah \xe3\x82\xa4 blah\n")
406 > f.write(b"blah \xe3\x82\xa4 blah\n")
407 > EOF
407 > EOF
408 $ hg ci -m 'slightly change utf8 char' utf8
408 $ hg ci -m 'slightly change utf8 char' utf8
409
409
410 $ hg diff --config diff.word-diff=True --color=debug -c.
410 $ hg diff --config diff.word-diff=True --color=debug -c.
411 [diff.diffline|diff --git a/utf8 b/utf8]
411 [diff.diffline|diff --git a/utf8 b/utf8]
412 [diff.file_a|--- a/utf8]
412 [diff.file_a|--- a/utf8]
413 [diff.file_b|+++ b/utf8]
413 [diff.file_b|+++ b/utf8]
414 [diff.hunk|@@ -1,1 +1,1 @@]
414 [diff.hunk|@@ -1,1 +1,1 @@]
415 [diff.deleted|-][diff.deleted.unchanged|blah ][diff.deleted.changed|\xe3\x82\xa2][diff.deleted.unchanged| blah] (esc)
415 [diff.deleted|-][diff.deleted.unchanged|blah ][diff.deleted.changed|\xe3\x82\xa2][diff.deleted.unchanged| blah] (esc)
416 [diff.inserted|+][diff.inserted.unchanged|blah ][diff.inserted.changed|\xe3\x82\xa4][diff.inserted.unchanged| blah] (esc)
416 [diff.inserted|+][diff.inserted.unchanged|blah ][diff.inserted.changed|\xe3\x82\xa4][diff.inserted.unchanged| blah] (esc)
@@ -1,407 +1,407 b''
1 $ cat <<EOF >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [ui]
2 > [ui]
3 > color = always
3 > color = always
4 > [color]
4 > [color]
5 > mode = ansi
5 > mode = ansi
6 > EOF
6 > EOF
7 Terminfo codes compatibility fix
7 Terminfo codes compatibility fix
8 $ echo "color.none=0" >> $HGRCPATH
8 $ echo "color.none=0" >> $HGRCPATH
9
9
10 $ hg init repo1
10 $ hg init repo1
11 $ cd repo1
11 $ cd repo1
12 $ mkdir a b a/1 b/1 b/2
12 $ mkdir a b a/1 b/1 b/2
13 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
13 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
14
14
15 hg status in repo root:
15 hg status in repo root:
16
16
17 $ hg status
17 $ hg status
18 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
18 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
19 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
19 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
20 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
20 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
21 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
21 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
22 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
22 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
23 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
23 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
24
24
25 $ hg status --color=debug
25 $ hg status --color=debug
26 [status.unknown|? ][status.unknown|a/1/in_a_1]
26 [status.unknown|? ][status.unknown|a/1/in_a_1]
27 [status.unknown|? ][status.unknown|a/in_a]
27 [status.unknown|? ][status.unknown|a/in_a]
28 [status.unknown|? ][status.unknown|b/1/in_b_1]
28 [status.unknown|? ][status.unknown|b/1/in_b_1]
29 [status.unknown|? ][status.unknown|b/2/in_b_2]
29 [status.unknown|? ][status.unknown|b/2/in_b_2]
30 [status.unknown|? ][status.unknown|b/in_b]
30 [status.unknown|? ][status.unknown|b/in_b]
31 [status.unknown|? ][status.unknown|in_root]
31 [status.unknown|? ][status.unknown|in_root]
32 HGPLAIN disables color
32 HGPLAIN disables color
33 $ HGPLAIN=1 hg status --color=debug
33 $ HGPLAIN=1 hg status --color=debug
34 ? a/1/in_a_1 (glob)
34 ? a/1/in_a_1 (glob)
35 ? a/in_a (glob)
35 ? a/in_a (glob)
36 ? b/1/in_b_1 (glob)
36 ? b/1/in_b_1 (glob)
37 ? b/2/in_b_2 (glob)
37 ? b/2/in_b_2 (glob)
38 ? b/in_b (glob)
38 ? b/in_b (glob)
39 ? in_root
39 ? in_root
40 HGPLAINEXCEPT=color does not disable color
40 HGPLAINEXCEPT=color does not disable color
41 $ HGPLAINEXCEPT=color hg status --color=debug
41 $ HGPLAINEXCEPT=color hg status --color=debug
42 [status.unknown|? ][status.unknown|a/1/in_a_1] (glob)
42 [status.unknown|? ][status.unknown|a/1/in_a_1] (glob)
43 [status.unknown|? ][status.unknown|a/in_a] (glob)
43 [status.unknown|? ][status.unknown|a/in_a] (glob)
44 [status.unknown|? ][status.unknown|b/1/in_b_1] (glob)
44 [status.unknown|? ][status.unknown|b/1/in_b_1] (glob)
45 [status.unknown|? ][status.unknown|b/2/in_b_2] (glob)
45 [status.unknown|? ][status.unknown|b/2/in_b_2] (glob)
46 [status.unknown|? ][status.unknown|b/in_b] (glob)
46 [status.unknown|? ][status.unknown|b/in_b] (glob)
47 [status.unknown|? ][status.unknown|in_root]
47 [status.unknown|? ][status.unknown|in_root]
48
48
49 hg status with template
49 hg status with template
50 $ hg status -T "{label('red', path)}\n" --color=debug
50 $ hg status -T "{label('red', path)}\n" --color=debug
51 [red|a/1/in_a_1]
51 [red|a/1/in_a_1]
52 [red|a/in_a]
52 [red|a/in_a]
53 [red|b/1/in_b_1]
53 [red|b/1/in_b_1]
54 [red|b/2/in_b_2]
54 [red|b/2/in_b_2]
55 [red|b/in_b]
55 [red|b/in_b]
56 [red|in_root]
56 [red|in_root]
57
57
58 hg status . in repo root:
58 hg status . in repo root:
59
59
60 $ hg status .
60 $ hg status .
61 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
61 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
62 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
62 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
63 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
63 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
64 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
64 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
65 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
65 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
66 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
66 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
67
67
68 $ hg status --cwd a
68 $ hg status --cwd a
69 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
69 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
70 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
70 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
71 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
71 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
72 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
72 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
73 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
73 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
74 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
74 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
75 $ hg status --cwd a .
75 $ hg status --cwd a .
76 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
76 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
77 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
77 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
78 $ hg status --cwd a ..
78 $ hg status --cwd a ..
79 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
79 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
80 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
80 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
81 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/1/in_b_1\x1b[0m (esc)
81 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/1/in_b_1\x1b[0m (esc)
82 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/2/in_b_2\x1b[0m (esc)
82 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/2/in_b_2\x1b[0m (esc)
83 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/in_b\x1b[0m (esc)
83 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/in_b\x1b[0m (esc)
84 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
84 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
85
85
86 $ hg status --cwd b
86 $ hg status --cwd b
87 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
87 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
88 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
88 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
89 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
89 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
90 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
90 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
91 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
91 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
92 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
92 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
93 $ hg status --cwd b .
93 $ hg status --cwd b .
94 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
94 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
95 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
95 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
96 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
96 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
97 $ hg status --cwd b ..
97 $ hg status --cwd b ..
98 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/1/in_a_1\x1b[0m (esc)
98 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/1/in_a_1\x1b[0m (esc)
99 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/in_a\x1b[0m (esc)
99 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/in_a\x1b[0m (esc)
100 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
100 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
101 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
101 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
102 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
102 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
103 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
103 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
104
104
105 $ hg status --cwd a/1
105 $ hg status --cwd a/1
106 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
106 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
107 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
107 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
108 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
108 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
109 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
109 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
110 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
110 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
111 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
111 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
112 $ hg status --cwd a/1 .
112 $ hg status --cwd a/1 .
113 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
113 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
114 $ hg status --cwd a/1 ..
114 $ hg status --cwd a/1 ..
115 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
115 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
116 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_a\x1b[0m (esc)
116 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_a\x1b[0m (esc)
117
117
118 $ hg status --cwd b/1
118 $ hg status --cwd b/1
119 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
119 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
120 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
120 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
121 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
121 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
122 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
122 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
123 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
123 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
124 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
124 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
125 $ hg status --cwd b/1 .
125 $ hg status --cwd b/1 .
126 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
126 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
127 $ hg status --cwd b/1 ..
127 $ hg status --cwd b/1 ..
128 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
128 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
129 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../2/in_b_2\x1b[0m (esc)
129 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../2/in_b_2\x1b[0m (esc)
130 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
130 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
131
131
132 $ hg status --cwd b/2
132 $ hg status --cwd b/2
133 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
133 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
134 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
134 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
135 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
135 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
136 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
136 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
137 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
137 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
138 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
138 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
139 $ hg status --cwd b/2 .
139 $ hg status --cwd b/2 .
140 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
140 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
141 $ hg status --cwd b/2 ..
141 $ hg status --cwd b/2 ..
142 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../1/in_b_1\x1b[0m (esc)
142 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../1/in_b_1\x1b[0m (esc)
143 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
143 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
144 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
144 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
145
145
146 Make sure --color=never works
146 Make sure --color=never works
147 $ hg status --color=never
147 $ hg status --color=never
148 ? a/1/in_a_1
148 ? a/1/in_a_1
149 ? a/in_a
149 ? a/in_a
150 ? b/1/in_b_1
150 ? b/1/in_b_1
151 ? b/2/in_b_2
151 ? b/2/in_b_2
152 ? b/in_b
152 ? b/in_b
153 ? in_root
153 ? in_root
154
154
155 Make sure ui.formatted=False works
155 Make sure ui.formatted=False works
156 $ hg status --color=auto --config ui.formatted=False
156 $ hg status --color=auto --config ui.formatted=False
157 ? a/1/in_a_1
157 ? a/1/in_a_1
158 ? a/in_a
158 ? a/in_a
159 ? b/1/in_b_1
159 ? b/1/in_b_1
160 ? b/2/in_b_2
160 ? b/2/in_b_2
161 ? b/in_b
161 ? b/in_b
162 ? in_root
162 ? in_root
163
163
164 $ cd ..
164 $ cd ..
165
165
166 $ hg init repo2
166 $ hg init repo2
167 $ cd repo2
167 $ cd repo2
168 $ touch modified removed deleted ignored
168 $ touch modified removed deleted ignored
169 $ echo "^ignored$" > .hgignore
169 $ echo "^ignored$" > .hgignore
170 $ hg ci -A -m 'initial checkin'
170 $ hg ci -A -m 'initial checkin'
171 adding .hgignore
171 \x1b[0;32madding .hgignore\x1b[0m (esc)
172 adding deleted
172 \x1b[0;32madding deleted\x1b[0m (esc)
173 adding modified
173 \x1b[0;32madding modified\x1b[0m (esc)
174 adding removed
174 \x1b[0;32madding removed\x1b[0m (esc)
175 $ hg log --color=debug
175 $ hg log --color=debug
176 [log.changeset changeset.draft|changeset: 0:389aef86a55e]
176 [log.changeset changeset.draft|changeset: 0:389aef86a55e]
177 [log.tag|tag: tip]
177 [log.tag|tag: tip]
178 [log.user|user: test]
178 [log.user|user: test]
179 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
179 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
180 [log.summary|summary: initial checkin]
180 [log.summary|summary: initial checkin]
181
181
182 $ hg log -Tcompact --color=debug
182 $ hg log -Tcompact --color=debug
183 [log.changeset changeset.draft|0][tip] [log.node|389aef86a55e] [log.date|1970-01-01 00:00 +0000] [log.user|test]
183 [log.changeset changeset.draft|0][tip] [log.node|389aef86a55e] [log.date|1970-01-01 00:00 +0000] [log.user|test]
184 [ui.note log.description|initial checkin]
184 [ui.note log.description|initial checkin]
185
185
186 Labels on empty strings should not be displayed, labels on custom
186 Labels on empty strings should not be displayed, labels on custom
187 templates should be.
187 templates should be.
188
188
189 $ hg log --color=debug -T '{label("my.label",author)}\n{label("skipped.label","")}'
189 $ hg log --color=debug -T '{label("my.label",author)}\n{label("skipped.label","")}'
190 [my.label|test]
190 [my.label|test]
191 $ touch modified added unknown ignored
191 $ touch modified added unknown ignored
192 $ hg add added
192 $ hg add added
193 $ hg remove removed
193 $ hg remove removed
194 $ rm deleted
194 $ rm deleted
195
195
196 hg status:
196 hg status:
197
197
198 $ hg status
198 $ hg status
199 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
199 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
200 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
200 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
201 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
201 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
202 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
202 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
203
203
204 hg status modified added removed deleted unknown never-existed ignored:
204 hg status modified added removed deleted unknown never-existed ignored:
205
205
206 $ hg status modified added removed deleted unknown never-existed ignored
206 $ hg status modified added removed deleted unknown never-existed ignored
207 never-existed: * (glob)
207 never-existed: * (glob)
208 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
208 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
209 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
209 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
210 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
210 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
211 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
211 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
212
212
213 $ hg copy modified copied
213 $ hg copy modified copied
214
214
215 hg status -C:
215 hg status -C:
216
216
217 $ hg status -C
217 $ hg status -C
218 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
218 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
219 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
219 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
220 \x1b[0;0m modified\x1b[0m (esc)
220 \x1b[0;0m modified\x1b[0m (esc)
221 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
221 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
222 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
222 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
223 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
223 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
224
224
225 hg status -A:
225 hg status -A:
226
226
227 $ hg status -A
227 $ hg status -A
228 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
228 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
229 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
229 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
230 \x1b[0;0m modified\x1b[0m (esc)
230 \x1b[0;0m modified\x1b[0m (esc)
231 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
231 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
232 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
232 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
233 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
233 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
234 \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
234 \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
235 \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc)
235 \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc)
236 \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc)
236 \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc)
237
237
238
238
239 hg status -A (with terminfo color):
239 hg status -A (with terminfo color):
240
240
241 #if tic
241 #if tic
242
242
243 $ mkdir "$TESTTMP/terminfo"
243 $ mkdir "$TESTTMP/terminfo"
244 $ TERMINFO="$TESTTMP/terminfo" tic "$TESTDIR/hgterm.ti"
244 $ TERMINFO="$TESTTMP/terminfo" tic "$TESTDIR/hgterm.ti"
245 $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo -A
245 $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo -A
246 \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m (esc)
246 \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m (esc)
247 \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m (esc)
247 \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m (esc)
248 \x1b[30m\x1b[30m modified\x1b[30m (esc)
248 \x1b[30m\x1b[30m modified\x1b[30m (esc)
249 \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m (esc)
249 \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m (esc)
250 \x1b[30m\x1b[36m\x1b[1m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc)
250 \x1b[30m\x1b[36m\x1b[1m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc)
251 \x1b[30m\x1b[35m\x1b[1m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc)
251 \x1b[30m\x1b[35m\x1b[1m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc)
252 \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m (esc)
252 \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m (esc)
253 \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc)
253 \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc)
254 \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc)
254 \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc)
255
255
256 The user can define effects with raw terminfo codes:
256 The user can define effects with raw terminfo codes:
257
257
258 $ cat <<EOF >> $HGRCPATH
258 $ cat <<EOF >> $HGRCPATH
259 > # Completely bogus code for dim
259 > # Completely bogus code for dim
260 > terminfo.dim = \E[88m
260 > terminfo.dim = \E[88m
261 > # We can override what's in the terminfo database, too
261 > # We can override what's in the terminfo database, too
262 > terminfo.bold = \E[2m
262 > terminfo.bold = \E[2m
263 > EOF
263 > EOF
264 $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo --config color.status.clean=dim -A
264 $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo --config color.status.clean=dim -A
265 \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2madded\x1b[30m (esc)
265 \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2madded\x1b[30m (esc)
266 \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2mcopied\x1b[30m (esc)
266 \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2mcopied\x1b[30m (esc)
267 \x1b[30m\x1b[30m modified\x1b[30m (esc)
267 \x1b[30m\x1b[30m modified\x1b[30m (esc)
268 \x1b[30m\x1b[31m\x1b[2mR \x1b[30m\x1b[30m\x1b[31m\x1b[2mremoved\x1b[30m (esc)
268 \x1b[30m\x1b[31m\x1b[2mR \x1b[30m\x1b[30m\x1b[31m\x1b[2mremoved\x1b[30m (esc)
269 \x1b[30m\x1b[36m\x1b[2m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[2m\x1b[4mdeleted\x1b[30m (esc)
269 \x1b[30m\x1b[36m\x1b[2m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[2m\x1b[4mdeleted\x1b[30m (esc)
270 \x1b[30m\x1b[35m\x1b[2m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[2m\x1b[4munknown\x1b[30m (esc)
270 \x1b[30m\x1b[35m\x1b[2m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[2m\x1b[4munknown\x1b[30m (esc)
271 \x1b[30m\x1b[30m\x1b[2mI \x1b[30m\x1b[30m\x1b[30m\x1b[2mignored\x1b[30m (esc)
271 \x1b[30m\x1b[30m\x1b[2mI \x1b[30m\x1b[30m\x1b[30m\x1b[2mignored\x1b[30m (esc)
272 \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88m.hgignore\x1b[30m (esc)
272 \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88m.hgignore\x1b[30m (esc)
273 \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88mmodified\x1b[30m (esc)
273 \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88mmodified\x1b[30m (esc)
274
274
275 #endif
275 #endif
276
276
277
277
278 $ echo "^ignoreddir$" > .hgignore
278 $ echo "^ignoreddir$" > .hgignore
279 $ mkdir ignoreddir
279 $ mkdir ignoreddir
280 $ touch ignoreddir/file
280 $ touch ignoreddir/file
281
281
282 hg status ignoreddir/file:
282 hg status ignoreddir/file:
283
283
284 $ hg status ignoreddir/file
284 $ hg status ignoreddir/file
285
285
286 hg status -i ignoreddir/file:
286 hg status -i ignoreddir/file:
287
287
288 $ hg status -i ignoreddir/file
288 $ hg status -i ignoreddir/file
289 \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignoreddir/file\x1b[0m (esc)
289 \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignoreddir/file\x1b[0m (esc)
290 $ cd ..
290 $ cd ..
291
291
292 check 'status -q' and some combinations
292 check 'status -q' and some combinations
293
293
294 $ hg init repo3
294 $ hg init repo3
295 $ cd repo3
295 $ cd repo3
296 $ touch modified removed deleted ignored
296 $ touch modified removed deleted ignored
297 $ echo "^ignored$" > .hgignore
297 $ echo "^ignored$" > .hgignore
298 $ hg commit -A -m 'initial checkin'
298 $ hg commit -A -m 'initial checkin'
299 adding .hgignore
299 \x1b[0;32madding .hgignore\x1b[0m (esc)
300 adding deleted
300 \x1b[0;32madding deleted\x1b[0m (esc)
301 adding modified
301 \x1b[0;32madding modified\x1b[0m (esc)
302 adding removed
302 \x1b[0;32madding removed\x1b[0m (esc)
303 $ touch added unknown ignored
303 $ touch added unknown ignored
304 $ hg add added
304 $ hg add added
305 $ echo "test" >> modified
305 $ echo "test" >> modified
306 $ hg remove removed
306 $ hg remove removed
307 $ rm deleted
307 $ rm deleted
308 $ hg copy modified copied
308 $ hg copy modified copied
309
309
310 test unknown color
310 test unknown color
311
311
312 $ hg --config color.status.modified=periwinkle status
312 $ hg --config color.status.modified=periwinkle status
313 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
313 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
314 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
314 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
315 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
315 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
316 M modified
316 M modified
317 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
317 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
318 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
318 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
319 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
319 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
320 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
320 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
321 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
321 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
322
322
323 Run status with 2 different flags.
323 Run status with 2 different flags.
324 Check if result is the same or different.
324 Check if result is the same or different.
325 If result is not as expected, raise error
325 If result is not as expected, raise error
326
326
327 $ assert() {
327 $ assert() {
328 > hg status $1 > ../a
328 > hg status $1 > ../a
329 > hg status $2 > ../b
329 > hg status $2 > ../b
330 > if diff ../a ../b > /dev/null; then
330 > if diff ../a ../b > /dev/null; then
331 > out=0
331 > out=0
332 > else
332 > else
333 > out=1
333 > out=1
334 > fi
334 > fi
335 > if [ $3 -eq 0 ]; then
335 > if [ $3 -eq 0 ]; then
336 > df="same"
336 > df="same"
337 > else
337 > else
338 > df="different"
338 > df="different"
339 > fi
339 > fi
340 > if [ $out -ne $3 ]; then
340 > if [ $out -ne $3 ]; then
341 > echo "Error on $1 and $2, should be $df."
341 > echo "Error on $1 and $2, should be $df."
342 > fi
342 > fi
343 > }
343 > }
344
344
345 assert flag1 flag2 [0-same | 1-different]
345 assert flag1 flag2 [0-same | 1-different]
346
346
347 $ assert "-q" "-mard" 0
347 $ assert "-q" "-mard" 0
348 $ assert "-A" "-marduicC" 0
348 $ assert "-A" "-marduicC" 0
349 $ assert "-qA" "-mardcC" 0
349 $ assert "-qA" "-mardcC" 0
350 $ assert "-qAui" "-A" 0
350 $ assert "-qAui" "-A" 0
351 $ assert "-qAu" "-marducC" 0
351 $ assert "-qAu" "-marducC" 0
352 $ assert "-qAi" "-mardicC" 0
352 $ assert "-qAi" "-mardicC" 0
353 $ assert "-qu" "-u" 0
353 $ assert "-qu" "-u" 0
354 $ assert "-q" "-u" 1
354 $ assert "-q" "-u" 1
355 $ assert "-m" "-a" 1
355 $ assert "-m" "-a" 1
356 $ assert "-r" "-d" 1
356 $ assert "-r" "-d" 1
357 $ cd ..
357 $ cd ..
358
358
359 test 'resolve -l'
359 test 'resolve -l'
360
360
361 $ hg init repo4
361 $ hg init repo4
362 $ cd repo4
362 $ cd repo4
363 $ echo "file a" > a
363 $ echo "file a" > a
364 $ echo "file b" > b
364 $ echo "file b" > b
365 $ hg add a b
365 $ hg add a b
366 $ hg commit -m "initial"
366 $ hg commit -m "initial"
367 $ echo "file a change 1" > a
367 $ echo "file a change 1" > a
368 $ echo "file b change 1" > b
368 $ echo "file b change 1" > b
369 $ hg commit -m "head 1"
369 $ hg commit -m "head 1"
370 $ hg update 0
370 $ hg update 0
371 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
371 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 $ echo "file a change 2" > a
372 $ echo "file a change 2" > a
373 $ echo "file b change 2" > b
373 $ echo "file b change 2" > b
374 $ hg commit -m "head 2"
374 $ hg commit -m "head 2"
375 created new head
375 created new head
376 $ hg merge
376 $ hg merge
377 merging a
377 merging a
378 merging b
378 merging b
379 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
379 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
380 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
380 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
381 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
381 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
382 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
382 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
383 [1]
383 [1]
384 $ hg resolve -m b
384 $ hg resolve -m b
385
385
386 hg resolve with one unresolved, one resolved:
386 hg resolve with one unresolved, one resolved:
387
387
388 $ hg resolve -l
388 $ hg resolve -l
389 \x1b[0;31;1mU \x1b[0m\x1b[0;31;1ma\x1b[0m (esc)
389 \x1b[0;31;1mU \x1b[0m\x1b[0;31;1ma\x1b[0m (esc)
390 \x1b[0;32;1mR \x1b[0m\x1b[0;32;1mb\x1b[0m (esc)
390 \x1b[0;32;1mR \x1b[0m\x1b[0;32;1mb\x1b[0m (esc)
391
391
392 color coding of error message with current availability of curses
392 color coding of error message with current availability of curses
393
393
394 $ hg unknowncommand > /dev/null
394 $ hg unknowncommand > /dev/null
395 hg: unknown command 'unknowncommand'
395 hg: unknown command 'unknowncommand'
396 (use 'hg help' for a list of commands)
396 (use 'hg help' for a list of commands)
397 [255]
397 [255]
398
398
399 color coding of error message without curses
399 color coding of error message without curses
400
400
401 $ echo 'raise ImportError' > curses.py
401 $ echo 'raise ImportError' > curses.py
402 $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null
402 $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null
403 hg: unknown command 'unknowncommand'
403 hg: unknown command 'unknowncommand'
404 (use 'hg help' for a list of commands)
404 (use 'hg help' for a list of commands)
405 [255]
405 [255]
406
406
407 $ cd ..
407 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now