contact Me

Use the form on the right to contact me.

You are welcome, to contact me regarding the topics of this page, my open source projects, or my work. Please use the contact form and leave a valid email address for me to respond to.

Thank you.

Egidestr. 9
44892 Bochum


Random thoughts, bright ideas and interesting experiments. In short the ramblings of a fulltime nerd.


Subversion enhancements for your commandline

Jakob Westhoff

I am mainly using subversion to manage nearly all of my development projects as well as a lot of other stuff which benefits from revisioning. Because I mainly use vim for all my editing needs, I am working on the commandline a lot. This includes the commandline client "svn". I integrated some little bash helper functions, to make the svn output even more readable and useful, into my workflow over the time.

I decided to put all those little helpers together into one bash function, which wraps around the svn command. To easy the handling of it even more.

Some of these "enhancements" are written by me some are written by others, like Kore Nordmann.


You might ask yourself what enhancements could be made to the svn command line utility as it is quite perfect. Let me give you a listing of improvements done.


The diffing is improved by utilizing the colordiff utility to colorize its output for better readability.

Furthermore less is used for displaying to make scrolling inside larger diffsets easier.

${SVN} diff ${arguments}|colordiff|less


The update function of svn is enhanced thanks to a blog article I discovered some years ago. Graeme Mathieson provides a bash function in it which displays the log entries for the changes made since your last update.

# This snippet is taken from a blog post found on the net. My
# thanks go out to the author of it.
# I have slightly modified it to better suit my needs.

local old_revision=`${SVN} info ${arguments} | awk '/^Revision:/ {print $2}'`
local first_update=$((${old_revision} + 1))

${SVN} up ${arguments}

local new_revision=`${SVN} info ${arguments} | awk '/^Revision:/ {print $2}'`

if [ ${new_revision} -gt ${old_revision} ]; then
  svn log -v -rHEAD:${first_update} ${arguments}
  echo "No changes."


Kore Nordmann gave me a sed one liner some days ago which colorizes the status output of the subversion client. Furthermore it filters out svn external links, which are normally just a distraction from the things that changed.

# My thanks for this snippet go to Kore Nordmann
# (
${SVN} st --ignore-externals ${arguments} | grep -v '^X' | sed -e 's/^\?.*$/^[[1;34m\0^[[m/' -e 's/^!.*$/^[[1;31m\0^[[m/' -e 's/^A.*$/^[[1;32m\0^[[m/' -e 's/^M.*$/^[[1;33m\0^[[m/' -e 's/^D.*$/^[[0;31m\0^[[m/'

Log and Blame

After Kore send the status colorizer to me I decided to create similar expressions for log and blame/praise.

${SVN} log ${arguments}|sed -e 's/^-\+$/^[[1;32m\0^[[m/' -e 's/^r[0-9]\+.\+$/^[[1;31m\0^[[m/'

${SVN} blame ${arguments}|sed -e 's/^\(\s*[0-9]\+\s*\)\([^ ]\+\s*\)\(.*\)$/^[[1;32m\1^[[m^[[1;31m\2^[[m\3/'

Putting it all together

I put all of the above features together in one simple bash function. You can download it here. Just copy the contents of the downloaded file to your .bashrc file. No further work should be needed. The enhancements will just magically work after you loaded a new shell.

Please make sure you use a proper editor to copy the contents of the file to your .bashrc file, because otherwise the color escape codes may not be inserted correctly.


After reading Kores comment about the problems which may be introduced by simple wrapping around the svn command. I put together a file containing the nameing scheme sugested by him in is comment. You can download it here. Use it instead of the other scripts linked above if you often need the default functionality of the svn command.

If you are using the svn wrapper command you may still call the original unmodified svn binary at any time using its full path. This would be "/usr/bin/svn" in most of the cases. I still think using the wrapper is the way to go, because you will most likely use the enhancements a lot more than needing the original output. Therefore I prefer calling the svn binary in those rare cases directly.