[PATCH 0 of 3] color: diff colorization, terminal detection

Brodie Rao dackze at gmail.com
Wed Nov 12 09:35:47 CST 2008


Oops, I accidentally omitted a description when I ran hg send.

These patches do the following:

1. Adds diff colorization for diff, qdiff, log -p, outgoing -p, and
incoming -p. Unlike the other wrapper commands in the color extension,
the colordiff wrapper doesn't buffer the command's entire output.
Instead, it wraps ui.write and colorizes as the command writes output.
This works a lot better for these commands, as they're usually high
output.

2. Fixes an unused import and a name error.

3. Replaces the --no-color switch with a --color switch, which works
exactly like GNU grep's --color switch. --color=auto turns on
colorization for non-dumb terminals outputting to a TTY. It first
tries to check isatty() on os.dup(1) before using sys.stdout, in case
something else has reassigned it (like another extension).


More information about the Mercurial-devel mailing list