Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /data/sites/web/remonpelnl/www/wp-content/themes/remonpel_nl__child__twentyfourteen/functions.php on line 32
Using multiple versions of SVN - automatically - transparently – Remons TechNotes

Using multiple versions of SVN – automatically – transparently

[UPDATE] This post is useless when you upgrade Xcode to version 5.0. If you use version 4 or you’re using a linux environment with svn 1.6 and 1.7 simultaneously; read on :) [/UPDATE]

So you have these projects in your development tree, these are probably managed by the version of Subversion as used on your mac – which with a very high probability would be version 1.6. But now and again, you might find yourself with a Subversion 1.7 project you received from someone else. Your mac will then shout something like this;

Shell outputsvn: The path '.' appears to be part of a Subversion 1.7 or greater
working copy. Please upgrade your Subversion client to use this
working copy.

If – like me – you are NOT prepared to switch to SubVersioN 1.7 entirely, then read on :)

First, make sure you have a way to install Subversion 1.7 as an extra – not as the default. I used HomeBrew for this, as I do with everything I have written on this blog. And HomeBrew was kind enough to install version 1.7 in /usr/local/bin/svn . Now, you might have to play with the PATH settings in your bash_profile (~/.bashrc or ~/.bash_profile) so that this version 1.7 SVN is NOT used by default.

Then add this to your bash_profile;

Shell commandalias svn17='/usr/local/bin/svn'

now you can use

Shell commandsvn17
like the regular
Shell commandsvn
to work on a Subversion 1.7 working copy.

That’s handy, right? right! but is it automatic? no… Transparent? no… we still have to remember which command to use and you probably won’t and get frustrated by the error mentioned earlier. All we did here is prevent having to type /usr/local/bin/svn every time we need version 1.7.

So we also add this;

Shell commandalias svn16='/usr/bin/svn'

now you can use

Shell commandsvn16
instead of
Shell commandsvn
to work on a subversion 1.6 working copy.

Wait…, wut?!… what good will that do?!… Good question. It allows us to force the use of Subversion 1.6. The why part comes in just about … now!

Add this;

Shell-Scriptsvn () {
svn16 "$@" 2> /tmp/$$.svn.out
[ cat /tmp/$$.svn.out | grep "Subversion 1.7" | wc -l | awk ' { print $1 } ' -gt 0 ] \
&& svn17 "$@"
rm /tmp/$$.svn.out

now you can use the

Shell commandsvn
command like always, and Subversion 1.6 will be used by default and if by any chance Subversion 1.7 is required, well, version 1.7 is used automatically.

Neat, huh?!


p.s. remember; if you make changes to your bash_profile, you have to reload it;

. ~/.bash_profile

Yes, that’s a . in front. You could also type

source ~/.bash_profile

“.” is just faster than “source” is :)

Author: Remon Pel

WebDeveloper though not WebDesigner

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Confidental Infomation
stop spam mail