Useful subversion bash functions

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.


About this entry