SVK is a distributed source control management system. At MindTouch, we use svk to mirror the public parts of our MindTouch svn repository to our public svn repository at SourceForge.net. Below is a brief tutorial on how we use SVK to do our mirrorring. Since the MindTouch repository requires authentication, you won't be able to use this tutorial unless you have credentials. However, it's a good real-world example.
svk depotmap --init
NOTE: you'll be prompted for credentials for the MindTouch SVN repository. The SF.net SVN repository only requires credentials in order to commit changes so you'll be prompted for credentials when performing a merge operation.
svk mirror //mirror/public-source https://svn.mindtouch.com/source/public/svk mirror //mirror/public-target https://dekiwiki.svn.sourceforge.net/svnroot/dekiwiki/public
svk sync -a
Now go and get a cup of coffee, bake some brownies, and walk the dog.
Once the sync has been completed, you can perform merges between the two mirrors. The first merge needs to be performed manually (since you'll be prompted for credentials), but svn will cache the credentials so subsequent merges can be done via cron.
svk smerge --incremental --baseless //mirror/public-source //mirror/public-target
Create a script named sync_svn.sh:
#!/bin/bashsvk smerge -IB //mirror/public-source //mirror/public-target svk sync -a
Make the script executable
chmod +x sync_svn.sh
Add it to your user's crontab
crontab -e
Add the cron entry
*/10 * * * * /home/petee/sync_svk.sh
If you're using files with UTF-8 characters, make SURE you have a UTF-8 local installed and have your LANGUAGE environment variable set. If you don't, you will see an error message like:
Use of uninitialized value in join or string at (eval 46) line 2. Can't encode as ascii.
On Debian, you can do this by running:
dpkg-reconfigure locales
And selecting: en_US.UTF-8 UTF-8
Then make sure to add the following to your ~/.bashrc
export LANG="en-US.UTF-8" export LANGUAGE="en-US.UTF-8"