Monday, May 7, 2007

Trac setup mirror of SVN repo with SVK (includes sync)

I needed to get a mirror of my project repo (AbTLinux) on a machine hosting our Trac project software. Not much clear information on the web so here is what I finally did to get this working (assuming you have followed the previous posts to setup apache and subversion and setup trac.
#  login as root and create local svk depot.
#
$ svk mkdir //mirrors

# link the local mirror to our abtlinux repo.
#
$ svk mirror https://abtlinux.svn.sourceforge.net/svnroot/abtlinux //mirrors/abtlinux

# sync initial content over to local mirror. Just add this
# to a cronjob and you will have automated syncing to
# keep the mirror updated.
#
$ svk sync -a

# now we need to move the local repo out of our ~/.svk/local location and into 
# our svn web based location.
#
$ mv ~/.svk/local /var/svnroot/mirrors

# change the svk depotmap to point to new location.
#
$ svk depotmap

# change the file that opens to point to your svn location, mine
# looks like this:
#
---
'': /var/svnroot/mirrors
===edit the above depot map===

Finally we point our /var/lib/trac/abtlinux/conf/trac.ini at the local svn mirrror site and resync your trac with:
# my resync looks like this:
#
$ sudo trac-admin /var/lib/trac/abtlinux resync