Search code examples
windowspowershellmercurialdvcs

Mercurial color extension in Windows Powershell


Is there a way to enable color support for Mercurial in Powershell on Windows 7? The ColorExtension page says to add

[color]
mode = win32

to your .hgrc file, but it doesn't seem to make a difference.

Running hg status shows several files that have not yet been added to the repository, and I believe they should have a pink color (based off other terminals I've seen). This is what's displayed instead:

←[0;35;1;4m? samplefile.php←[0m
←[0;35;1;4m? anotherfile.php←[0m
←[0;35;1;4m? derpderp.xml←[0m
←[0;35;1;4m? derp_model.php←[0m
←[0;35;1;4m? stillnocolor.php←[0m

Solution

  • You probably need to update to the latest mercurial (1.6.4). Version 1.5.4 in particular didn't do win32 color properly (and there have been quite a few color-related and win32-related bugs fixed in recent builds).

    You also need to make sure you're not specifying ANSI color mode. You can force win32:

    [color]
    mode = win32