Rename a branch in SVN

If you made a typo or a similar mistake when naming your new branch, and you want to rename it, is very simple:

svn move

Remember to switch any working copies of the old branch though:

svn switch


svnX – Use DiffMerge as diff tool

So, I use svnX on MacOSX and I find DiffMerge a much nicer application than the default FileMerge, but I couldn’t get it to load. I was getting some spurious error about a missing .sh file:

Can’t find tool ‘’ required to use DiffMerge

Anyway. I found this file in the following folder:


And I simply copied it to a folder within the path env,

cp /Applications/ /usr/local/bin/

Sorted. Don’t forget you actually have to change the application preferences.

Backup all SVN repos

If you need to backup your SVN repositories, then you can use this bash script to do so:

DATE=`date +"%Y-%m-%d"`
mkdir -p $BACKUP_DIR
for dir in `ls /var/svn/`; do
    svnadmin dump $RES_DIR | gzip > "${BACKUP_DIR}/${dir}.dump.gz";

This basically dumps every revision from each repository in your server, and gzip’s them and then puts them in /home/user/svn/backup under the current date

Enabling SVN log message editing

Subversion, by default will stop you from editing a log message after its been committed. This is because SVN has a powerful feature called ‘hooks’ that enable the repo administrator to control the message logs when their developers are committing.

Fortunately, if you have access to the repo, you can switch off the hook that stops this.

The process is to copy the ‘template’ hook as a proper hook and de-activate it.

SSH into the server and go to the SVN repo folder (as sudo)

sudo su
cd /home/svn/codebase
cp hooks/pre-revprop-change.tmpl hooks/pre-revprop-change

Then, edit the hooks/pre-revprop-change file. All you need to do is stick this at the top of the file:

exit 0

The above command will return a success message to the SVN repo and every change will be allowed.

And every log message change will be accepted. Now, be warned that this will allow people to piss about and change their messages ‘after the fact’ and you won’t have any control over it. But if you work in a small trustworthy team like me, then its not such a biggie.

Just FYI, the command for changing an SVN log message is :

svn propset -r <revision> --revprop svn:log "<enter your new log message here>"

Note: You do not need to specify the SVN URL if you perform this command from within your SVN working copy.

If your message is a simple edit or you want to write loads, you can leave off the message and it will open a text editor with the existing message in, and when you save and quit, it will update the message with what ever is in the file. Like so:

svn propedit -r <revision> --revprop svn:log

God, Windows is sloooooow

I am assisting a colleague today check out a rather large feature branch. I showed him the branch address and he started checking it out using Tortoise SVN on Windows 7.

Upon returning to my desk (Ubuntu 11.10), I decided to merge the branch with the major trunk. I checked out a brand new copy of the branch, merged it (for the first time in several months) and then re-committed the pages.

Guess what, he’s still checking out the original!!!

Do yourselves a favour guys, make it Linux this Christmas…

SVN Externals – how to add them

When creating a Zend Framework site, its always best to keep the Zend library as an external source. This way you can keep the branch up-to-date with the release of Zend with a simple text file.

To access the externals file, navigate to the root of your site:

> cd /var/www/mysite

And add the external to the svn:externals file. I am using the latest version of Zend Framework for this, but you can use any SVN source you like. Note, it has to be available as an SVN repository.

> svn propedit svn:externals .

This will open a text editor.

To enter an external, just enter the local folder to download to, and the source SVN.

destination source

So, if I want my Zend Framework files to be saved in /var/www/mysite/library/Zend :


The first part is the local, second part is the URL of the repository.

Save and close.

Next time you do an update, svn will go and fetch the external files and save them for you.

Other externals are available, such as JQuery, various wikis and other JS sources.