22 February 2010

A few days ago, I found a handy script online that colorized the output of SVN status. It worked pretty well, but needed a little polish and a couple of tweaks to make it use more common Python idioms. Also, I fixed ANSI word-wrapping issues, created a configurable tab expansion feature (for better code alignment), added the 'colorizedSubcommands' sequence so that only applicable commands get colorized, and fixed subprocess calls so that piping through less will work (for example, try svn-color diff | less -r to see colorized diff output).

I hope you find my modifications useful. You can modify the colors used by looking up the ANSI color codes for your preferred color scheme and editing the 'statusColors' dictionary. Here's a useful reference for ANSI color values:


i've posted the code on snipplr, and it's also posted below after the break.