Colors in cygwin being displayed as raw ANSI codes

When you use the Cygwin console, the interpretation of control sequences is done by the Cygwin DLL. That DLL of course is only linked into Cygwin programs, so a non-Cygwin program like Mercurial will not be able to make use of that.

So why does it work when running in a cmd.exe console then, which doesn't understand control sequences in the first place? My guess would be that Mercurial uses the Windows console API when it thinks it runs in a console, and control sequences when it thinks it's running in a terminal. Perhaps that depends on whether TERM is set, so try what happens if you unset TERM.

Otherwise, try running it in a Cygwin terminal such as mintty or rxvt. There, the difference is that the control sequences are interpreted by those programs rather than the Cygwin DLL.


In your .hgrc file set

[color]
mode = ansi

or

[color]
mode = auto