Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I back up a remote SVN repository

Tags:

svn

backup

I am currently moving my SVN server from my home server to my remote server so I can access it more easily from other locations. My remote server is not backed up so I want to regularly back it up to my home server.

Remote server is Windows 2003 server. Home server is Windows Home Server.

What is the best way to do this? can I get my home server to get a dump of the remote server every night? Bandwidth isn't a huge consideration but if I could just copy any new checkins to an SVN server on my home server that would be fine.

Any suggestions welcome.

like image 590
Roaders Avatar asked Feb 20 '10 15:02

Roaders


People also ask

Where is my SVN repository located?

http:// or https:// This is svn over http or https. You need to find the virtual host in your apache configuration and look for a <Location> section that matches your url path and look for a SVNPath or SVNParentPath config line. This will tell you the location of your subversion repository.


2 Answers

Just use the svnsync command.

First, create a fresh repository on your home machine.

svnadmin create c:\backuprepo 

Or on Unix:

svnadmin create ./backuprepo 

Next, create a file named pre-revprop-change.bat:

echo exit 0 > c:\backuprepo\hooks\pre-revprop-change.bat 

Or on Unix:

echo -ne '#!/bin/sh\nexit 0' > ./backuprepo/hooks/pre-revprop-change chmod ugo+x ./backuprepo/hooks/pre-revprop-change  

then, initialize the sync:

svnsync init file:///c:/backuprepo https://url/of/your/repository 

Or on Unix:

svnsync init file:///Volumes/volumelabel/backuprepo https://url/of/your/repository 

After that, you can simply run

svnsync sync file:///c:/backuprepo 

once a day or so, and you'll get only those changes which are not yet in your backup repository. The first time it will take a while, but after you've synchronized your backup repository with the real one, it will only take a few seconds to sync it because only those revisions that are new need to be synched.

like image 178
Stefan Avatar answered Oct 20 '22 04:10

Stefan


As of subversion 1.7, you can also use the new command svnrdump. From the docs:

Dump—that is, generate a repository dump stream of—revisions of the repository item located at SOURCE_URL, printing the information to standard output.

Usage would be:

svnrdump dump http://example.com/repos/ > repos.dump 

This creates a "dump file" of the repository in repos.dump. This is a complete backup of your repository data including history, but is not directly readable by a subversion client. If you need to restore this data, use the standard svnadmin tools:

svnadmin create c:\backup-repos svnadmin load c:\backup-repos < repos.dump 

Haven't done any testing, but this might end up being slower than svnsync. svnrdump will do a complete dump of the repository everytime, where I'm assuming synsync will only import changes in the repository since the last time it was run. You will have a single file containing your entire repository though, which may or may not be easier to manage.

Note that you may want to pipe the output of svnrdump through gzip or similar program to possibly significantly reduce the size of the outputted file.

like image 31
joesdiner Avatar answered Oct 20 '22 06:10

joesdiner