uɐʎɹ ррoʇ uɐʎɹ bio photo

uɐʎɹ ррoʇ uɐʎɹ

Hello. Is is me you're looking for?
僕は猿ーロボット。
robotic life signs.
makes noise, hears sounds, intafon.
affe auf deux roues.

Email Github Github Gist Last.fm Soundcloud Flickr

Recently I wanted an easy way to generate diffs from svn that I could easily read — i.e. with some sort of markup. TextMate automatically displays diffs in an attractive manner, and in a manner that makes them much easier to decipher visually. It also allows you to export any code file as html, which is also nice; however, I didn’t want to keep having to open all my diffs in TextMate just for the sake of formatting them. I also wanted to be able to generate them quickly and be able to distribute them as standalone files that could ostensibly be viewed in a web browser.

I did a little research and found a script over at http://www.linuxjournal.com/content/convert-diff-output-colorized-html which was fairly close to what I wanted to do, so I started with that and modified its processing algorithm and css styling to match my TextMate output. After getting that working with static svn diff output files, I added the ability to simply navigate to the desired directory in the command line and invoke the script to output the html formatted diff.

At that point, I decided that there were 2 key comparisons that were important to me generally — svn diff -r HEAD and svn diff -r PREV:HEAD — which output the diff for the local file to the repository version, and the diff for the head as compared to the previous revision. In other words, one compares the stuff on your machine to the repository, and the other can compare what you just committed to what was there before. I added those, and a help command, and that become svndiff2html. I hope this helps someone save some time. Code follows after the break…