SVN: Useful bash commands

Here’s a couple of useful bash commands I’ve been using recently when working with Subversion:

The first helps me with an annoyance I have with externals. Normally doing a “svn st –ignore-externals” still lists all the externals even though I’m not actually interesting in seeing them when I want to know what I’ve changed locally. For example in the output below I only really want to know that I’ve changed ‘development-tenants.xml’, i’m not really interested in the rest.

Nadeems-Computer:zephyr-trunk nadeemshabir$ svn st --ignore externals
X      lib/arc
X      lib/moriarty
X      lib/simpleSAMLphp
X      3rdPartyDevelopmentTools/svnant-1.0.0
X      3rdPartyDevelopmentTools/PHPUnit
X      3rdPartyDevelopmentTools/selenium-server-1.0-beta-1
X      3rdPartyDevelopmentTools/selenium-core-0.8.3
M      developmentdata/development-tenants.xml

To address this the first command is an alias I’ve created that shows me all the files that I’ve changed/added/removed locally but specifically doesn’t list anything related to any externals

alias whatschanged='svn st --ignore-externals | grep -v "^X "'

The second bash command deals with the fact that I often have a large number of files I want to add to subversion all at once. This command takes all un-added files and adds them to subversion …

svn st | grep '^? ' | awk '{ print $2 }' | xargs svn add

Hope you find them useful.

SVN Time Lapse View

Came across a very useful Subversion utility today. SVNTimeLapseView downloads every revision of a file from your subversion repository and allows you to scroll through the revisions using a simple slider control. As you scroll through revisions it highlights the changes that were made in each revision in blue. I found it very useful earlier today when trying to figure out what had changed in a .php file when trying to understand changes made to the file by another developer. It’s a simple but very useful tool!!

SVNTimeLapseView is free and works on any platform that runs Java, you can download it from here.