duguo.org »  last updated 15:43, 26 August 2008 by Du, Guo

Apache SVN

From duguo.org

Jump to: navigation, search

For security related configuration, please check out Apache SSL

Contents

Create repositories

cd /data/duguocom/home/svn
mkdir test
svnadmin create /data/duguocom/home/svn/test

sudo chown -R www-data /data/duguocom/home/svn/test
sudo chmod -R 0700 /data/duguocom/home/svn/test


Add location to virtual host

        <Location /svn/ >
           DAV svn
           SVNParentPath /data/duguocom/home/svn/
           SVNListParentPath On
        </Location>


For single repository

        <Location /svn/ >
           DAV svn
           SVNPath /data/duguocom/home/svn/
        </Location>


Tasks

Check out

svn co file:///data/duguocom/home/svn/test

or

svn co https://duguo.com/svn/test

Update

svn up /data/duguocom/home/svn/test

Auto Checkin

Original from http://www.gael-varoquaux.info/computers/svnautocommit/index.html

#!/bin/bash


#------------------------------- Subroutines ---------------------------------
usage(){
echo " Usage: $(basename $0) PATH"
echo ""
echo "Automatically commits the changes of svn working copy located in PATH."
echo "The new files are automatically added and the files that have been removed"
echo "are removed."
echo ""
echo "By Gael Varoquaux"
}

#------------------------------- Process the options -------------------------
if [ $# -eq 1 ]
then
    workingdir="$1"
else
    usage
    exit 1
fi

if ! cd $workingdir
then
    echo $workingdir is not a accessible path.
    usage
    exit 1
fi

#------------------------------- Find out what has changed -------------------

# A warning if this fails :
echo "SVN autocommit failed" > $HOME/motd

svnstatus=$(svn status $workingdir)
added=$(printf "$svnstatus" | sed -n 's/^[A?] *\(.*\)/\1/p')
removed=$(printf "$svnstatus" | sed -n 's/^! *\(.*\)/\1/p')

if [ "x$added" != "x" ]
then
    echo adding "$added" to repository
    svn add $added
fi

if [ "x$removed" != "x" ]
then
    echo removing "$removed" to repository
    svn remove $removed
fi

svn commit -m "autocommit" && rm $HOME/motd


Reference

http://alephzarro.com/blog/2007/01/07/installation-of-subversion-on-ubuntu-with-apache-ssl-and-basicauth/