Wednesday 13 June 2012

Clone a Subversion repository

... it almost feels like using Mercurial

I found this article on how to clone a remote SVN repository. In my case, I cloned a readonly Google Code repo to make some improvements.

Here's the recipe:

0. Download and Install SVN (pretty obvious really)

1. Create a local SVN repo. We'll call ours 'CLONE' and put it in /tmp so you can move it later. Windows types might want to create a C:\tmp directory. I can't remember whether MacOS has a /tmp - I'll try it when I get home.
svnadmin create /tmp/CLONE

2. Allow all revision property changes
echo '#!/bin/bash' >/tmp/CLONE/hooks/pre-revprop-change
chmod u+x /tmp/CLONE/hooks/pre-revprop-change

3. Select the repository you wish to clone
svnsync init file:///tmp/CLONE http://X.googlecode.com/svn/trunk/

4. Do the deed - this takes a while
svnsync sync file:///tmp/CLONE

5. and if, like me, you don't ever want to do it again remove the property change permission
rm /tmp/CLONE/hooks/pre-revprop-change

6. move your CLONE repo to wherever you really want it to live
mv /tmp/CLONE /home/mischief/WORLD_DOMINATION_PLAN_B


Remember to play nicely and respect the licence of repos you're cloning.

1 comment: