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.

1 thought on “SVN: Useful bash commands

Leave a Reply

Your email address will not be published. Required fields are marked *