[PATCH 3 of 3] color: removed --no-color, added auto colorization

Brodie Rao dackze at gmail.com
Wed Nov 12 12:54:13 CST 2008


On Wed, Nov 12, 2008 at 12:10 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> 2008/11/12 Brodie Rao <dackze at gmail.com>:
>> # HG changeset patch
>> # User Brodie Rao <me+hg at dackz.net>
>> # Date 1226502761 18000
>> # Node ID 8471ab51b5df2bd8d2e8dbb277fb810d85e5ba5c
>> # Parent  2fbcee0be37f7e9c2ccd27805dadb30e4296291c
>> color: removed --no-color, added auto colorization
>>
>> This works like GNU grep --color. --color=auto only colorizes output for non-dumb terminals that are TTYs
> [...]
>> +        if (opts['color'] == 'never' or
>> +            (opts['color'] == 'auto' and
>> +             (os.environ.get('TERM') == 'dumb' or not isatty))):
>> +            return orig(*args, **opts)
>> +        else:
>> +            return func(orig, *args, **opts)
>
> Does this work on Windows (where ANSI colour codes are not supported,
> but there is no TERM environment variable)?

In that case it would output the control codes anyway, like the color
extension acts right now. I don't think special casing Windows would
make sense. What if someone's using rxvt on Windows?

The extension's documentation says it uses ANSI control codes, but it
doesn't specifically mention that the Windows command prompt doesn't
support them. Maybe that could be clarified?


More information about the Mercurial-devel mailing list