SVN
Sunday, June 7, 2009 5:32:13 PM
Mirror an svn repository with svnsync: (http://www.kirkdesigns.co.uk/mirror-svn-repository-svnsync)
On the Slave
/srv/svn/repos/myproject/hooks/start-commit).:
Create the file /srv/svn/repos/myproject/hooks/pre-revprop-change.
On the Master
Our Slave machine is now ready, so jump over to the Master machine. First thing we need to do here is to initialise the svnsync target.
/srv/svn/repos/myproject/hooks/post-commit:
Create the file /srv/svn/repos/myproject/hooks/post-revprop-change:
Make sure both of these scripts are executable.
On the Slave
svnadmin create /svr/svn/myrepo chown -R www-data:www-data /svr/svn/myrepo
/srv/svn/repos/myproject/hooks/start-commit).:
#!/bin/sh USER="$2" if [ "$USER" = "svnsync" ]; then exit 0; fi echo "Only the svnsync user may commit new revisions" >&2 exit 1
Create the file /srv/svn/repos/myproject/hooks/pre-revprop-change.
#!/bin/sh USER="$3" if [ "$USER" = "svnsync" ]; then exit 0; fi echo "Only the svnsync user may change revision properties" >&2 exit 1
chmod 755 /srv/svn/repos/myproject/hooks/start-commit chmod 755 /srv/svn/repos/myproject/hooks/pre-revprop-change
On the Master
Our Slave machine is now ready, so jump over to the Master machine. First thing we need to do here is to initialise the svnsync target.
svnsync initialize https://target/myproject/ https://source/myproject/ \ --sync-username svnsync --sync-password syncpassword \ --source-username sourceusername --source-password sourcepassword
/srv/svn/repos/myproject/hooks/post-commit:
#!/bin/sh SVNSYNC=/usr/bin/svnsync TO=http://my.slave.machine/myproject/ SYNC_USER=svnsync SYNC_PASS=syncpassword SOURCE_USER=me SOURCE_PASS=mypassword $SVNSYNC --non-interactive sync $TO \ --sync-username $SYNC_USER --sync-password $SYNC_PASS \ --source-username $SOURCE_USER --source-password $SOURCE_PASS & exit 0
Create the file /srv/svn/repos/myproject/hooks/post-revprop-change:
#!/bin/sh SVNSYNC=/usr/bin/svnsync TO=http://my.slave.machine/myproject/ SYNC_USER=svnsync SYNC_PASS=syncpassword SOURCE_USER=me SOURCE_PASS=mypassword $SVNSYNC --non-interactive copy-revprops $TO \ --sync-username $SYNC_USER --sync-password $SYNC_PASS \ --source-username $SOURCE_USER --source-password $SOURCE_PASS $2 & exit 0
Make sure both of these scripts are executable.
chmod 755 /srv/svn/repos/myproject/hooks/post-commit chmod 755 /srv/svn/repos/myproject/hooks/post-revprop-change














