[issue2871] Piping hg commands on Windows with color extension enabled fails
Pascal Quantin
bugs at mercurial.selenic.com
Tue Jun 28 13:50:39 CDT 2011
New submission from Pascal Quantin <pascal.quantin at gmail.com>:
Using current stable branch, a simple command 'hg log | more' in Windows
console cmd.exe with color extension enabled triggers the following traceback:
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
** Mercurial Distributed SCM (version 1.8.4+220-2fbb57197093)
** Extensions loaded: churn, color, convert, eol, extdiff, graphlog, hgk,
highlight, mq, patchbomb, progress, rebase, transplant, histedit, git, svn,
shrink, hgnested
Traceback (most recent call last):
File "hg", line 38, in <module>
File "mercurial\dispatch.pyc", line 27, in run
File "mercurial\dispatch.pyc", line 64, in dispatch
File "mercurial\dispatch.pyc", line 87, in _runcatch
File "mercurial\dispatch.pyc", line 655, in _dispatch
File "mercurial\dispatch.pyc", line 447, in runcommand
File "mercurial\extensions.pyc", line 182, in wrap
File "hgext\color.pyc", line 349, in colorcmd
File "hgext\color.pyc", line 178, in _modesetup
TypeError: 'NoneType' object is not iterable
Explicitly setting the color.mode to win32 instead of auto allows to get the
output correctly piped but the following warning is displayed:
warning: failed to set color mode to win32
This was introduced by ad6ad51cc0dd: color: fix --color=always when output
is piped.
When looking at the code, the current behavior seems to be on purpose:
if realmode == 'win32':
if not w32effects and mode == 'win32':
# only warn if color.mode is explicitly set to win32
ui.warn(_('warning: failed to set color mode to %s\n') % mode)
return None
_effects.update(w32effects)
Even if a workaround is available, I do not find it nice to trigger the
traceback when using the auto mode that works without the pipe.
----------
messages: 16626
nosy: pqu
priority: bug
status: unread
title: Piping hg commands on Windows with color extension enabled fails
____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2871>
____________________________________________________
More information about the Mercurial-devel
mailing list