svnsync: mirror your svn repository
Since the svnsync tool in Subversion 1.4 still lacks documentation, here's a quick example to get you started with it:
$ svnadmin create svn.mochikit.com $ echo '#!/bin/sh' > svn.mochikit.com/hooks/pre-revprop-change $ chmod +x svn.mochikit.com/hooks/pre-revprop-change $ svnsync init file://$PWD/svn.mochikit.com http://svn.mochikit.com/ $ svnsync sync file://$PWD/svn.mochikit.com
The example performs the following tasks:
- Creates a new local repository named svn.mochikit.com
- Adds a trivial pre-revprop-change hook to the repository (required for svnsync)
- Initializes the svn.mochikit.com repository to be a mirror of http://svn.mochikit.com/
- Synchronizes the svn.mochikit.com repository with its initialized source
Note that this is point-in-time synchronization. To keep an up to date mirror you'll have to run svnsync sync on a regular basis (e.g. by cron job or post-commit hook).
If you're looking for an especially easy to install set of svn binaries for Mac OS X, I recommend Martin Ott's (of SubEthaEdit fame) build. I've been using it on all of my Macs for quite some time with no issues. Much less hassle than building it myself or using MacPorts (previously known as DarwinPorts).
Before i start to experiment - what this mirroring provides me ? Can i use it as a ‘buffer server’ when I’m on the road and still want to commit different changes into the ‘mirror’ repository and then sync them with the master when i get online? Can concurrent changes happen on the master server? What’s the point exactly ?
Comment by Martin — 2006-09-29 @ 6:42 am
No and no. It’s for backup purposes.
Comment by bob — 2006-09-29 @ 7:34 am
(re 1) for that, you probably want svk (bestpractical.com) though you still explicitly pull/push/sync “through” a local repository in that case, it looks about right for mobile-oriented use…
Comment by Mark Eichin — 2006-10-17 @ 7:08 pm
hi,
i followed the instructions, but when i do the last command:
C:\>svnsync init file:///svn-cph http://svn.iloopmobile.com/svn
C:\>svnsync init file:///svn-cph http://svn.iloopmobile.com/svn in the cmd window, all it does is sit there and give me a flashing cursor all over the window.
Not sure what is going on, but it seems that it might be waiting for a uid and passwd, as when i typr in the url: http://svn.iloopmobile.com/svn it asks for the uid and passwd. when i type it in, then it is ok.
Any ideas anyone?
thanks in advance…
marcus
Comment by marcus — 2006-11-14 @ 4:04 pm
Hi,
May be this question is already answered. But I was still unsure. I have setup a local svn mirror which syncs to the svn server installed elsewhere. Right now the setup is readonly and one way. Is there a way by which I can commit changes to the mirror and then this change is reflected in the master repo?
-Ajo
Comment by Ajo Paul — 2006-12-07 @ 7:41 am
Uh, yes. It’s already answered. You should bother to read the other comments!
Comment by bob — 2006-12-07 @ 4:41 pm