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.

Tags: alias, bash, function, Linux, subversion, svn

One Response to “Useful subversion bash functions”

davee says:

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