Useful subversion bash functions

Posted on Tuesday, October 17, 2006 in Linux

Inspired by bbum’s Useful subversion shell aliases I decided to to try them out for myself. Of course nothing is ever easy and they needed to be converted from aliases to functions to work under bash, as bash doesn’t support passing arguments according to Google.

You can read bbum’s post for more details but the idea behind these is that after you have run svn status you can copy’n’paste the output and have the results opened in your editor of choice.

So here are my functions, preconfigured to use GVim and its diff function:


 M () { svn diff "$*" | gvimdiff -; }
 G () { svn diff "$*" | gvimdiff -; }
 U () { svn diff "$*" | gvimdiff -; }
 R () { svn diff; }
 A () { true; }
 D () { true; }
 I () { true; }
 ? () { true; }

Place these in your ~/.bashrc and you’re ready to roll.

Update

As davee points out below, you could use his colordiff tool for viewing the output instead.

Related posts:

Using Subversion with Apache Virtual Hosts I’ve been using Subversion for a while through SSH. Whilst... My name in print …and this time I’ve got the cover all to myself!... Bestseller? Just did a quick check on how my book –...

Related posts brought to you by Yet Another Related Posts Plugin.

At the risk of being accused of blatant pimpage, you could always replace "gvimdiff -" with "colordiff" in the above … this will provide a much more lightweight option, since it doesn’t need to launch gVim.


Mobilized by Mowser Mowser
Mobilytics