Subversion and svnsync and websvn
Written by Administrator    Wednesday, 23 June 2010 11:27    PDF Print E-mail

This tutorial shows how to syncronzie your own local repository with a remote repository and sync with it. The result shall be displayed in the websvn GUI. How to add basic security is shown in apache2 and basic security on this web site.

------------------------------------------------

Time to setup a local  repository.

Step 1 Create a local directory to store checked out files.

mkdir /development/localcopy

Step 2 Create a subversion repository.

mkdir /development/repos/

svnadmin create /development/repos/svn

Step 3 Check out (nothing) to localcopy

cd /development/localcopy

svn co file:///development/repos/svn/

Check to see that you have a .svn file in /development/localcopy (then you are home free)

Ok so far what do we got.

We have one local repository (shall be synked) and one place to put our checked out files.

------------------------------------------------------------------------------

Time to connect local repository with remote

Let us now sync our local repository with the remote repository. Let us assume our remote repository is https://svn.foo.bar.com/svn. Let us assume that there is a user svnuser and a  password there svnpwd.

Do like this. Edit this file

vi /development/repos/svn/hooks/pre-revprop-change.tmpl and make it look like this;

 

USER="$3"

if [ "$USER" = "svnuser" ]; then exit 0; fi
echo "Only the svnsync user can change revprops" >&2
exit 1

and save it as /development/repos/svn/hooks/pre-revprop-change (that is without file ending)

Go to the repository.

cd /development/repos/svn

svnsync init --username svnuser file:///development/repos/svn/ https://svn.foo.bar.com/svn

This will set up the sync of your local repository.

And now sync;

svnsync sync file:///development/repos/svn/

This might take a while, but in the end your repository will be synchronized.

 

Time to connect svnweb with local repository

Edit this websvn file.

vi /usr/share/websvn/include/config.php

Add this line.

 

$config->addRepository('NameToDisplay', 'file:///development/repos/svn');

Crontab job

How do we  make svnsync do it regulary, well a crontab job. Let's do it every 30 minutes.

Create script to call from crontab and save it as sync.sh in /development/repository

#!/bin/sh
cd /development/repository
svnsync sync file:///development/repository/svn

 

chmod file to 755

Do this

crontab -e

add line

*/5 * * * * /development/repository/sync.sh

Last Updated ( Thursday, 24 June 2010 11:59 )
 

Your are currently browsing this site with Internet Explorer 6 (IE6).

Your current web browser must be updated to version 7 of Internet Explorer (IE7) to take advantage of all of template's capabilities.

Why should I upgrade to Internet Explorer 7? Microsoft has redesigned Internet Explorer from the ground up, with better security, new capabilities, and a whole new interface. Many changes resulted from the feedback of millions of users who tested prerelease versions of the new browser. The most compelling reason to upgrade is the improved security. The Internet of today is not the Internet of five years ago. There are dangers that simply didn't exist back in 2001, when Internet Explorer 6 was released to the world. Internet Explorer 7 makes surfing the web fundamentally safer by offering greater protection against viruses, spyware, and other online risks.

Get free downloads for Internet Explorer 7, including recommended updates as they become available. To download Internet Explorer 7 in the language of your choice, please visit the Internet Explorer 7 worldwide page.