Resource Menu


RE : Subversion
Here is a sample of code that could be used. But those script are specific to the way that you want it to work. Basically LS execute the query given in the property file and add the name of the new repository for its creation or the old name and the new name in case of a rename.

CreateSVNRepositoryForLS.sh

#!/bin/sh

if [ $# -ne 2 ]; then echo $0 svnparentpath svnrepository exit 1 fi

svnparentpath=$1 shift

if [ ! -d $svnparentpath ]; then echo $svnparentpath is not a valid folder… exit 2 fi

if [ $1 != `basename $1` ]; then echo $1 ambiguous repository name … exit 3 fi

if [ -e $svnparentpath/$1 ]; then echo $svnparentpath/$1 already exist… exit 4 fi

su www-data -c "mkdir $svnparentpath/$1; svnadmin create $svnparentpath/$1" #mkdir $svnparentpath/$1; svnadmin create $svnparentpath/$1

if [ $? != 0 ]; then echo problem during the svncreate phase exit 5 fi

exit 0

MoveSVNRepositoryForLS.sh

#!/bin/sh

if [ $# -ne 3 ]; then echo $0 svnparentpath sourcesvnrepository ciblesvnrepository exit 1 fi

svnparentpath=$1 shift

if [ ! -d $svnparentpath ]; then echo $svnparentpath is not a valid folder… exit 2 fi

if [ $1 != `basename $1` ]; then echo $1 ambiguous repository name … exit 3 fi

if [ $2 != `basename $2` ]; then echo $2 ambiguous repository name … exit 4 fi

if [ ! -d $svnparentpath/$1 ]; then echo $svnparentpath/$1 is not a valid folder… exit 5 fi

if [ -e $svnparentpath/$2 ]; then echo $svnparentpath/$2 already exist… exit 6 fi

su www-data -c "mv $svnparentpath/$1 $svnparentpath/$2"

if [ $? != 0 ]; then echo problem during the move phase exit 7 fi

exit 0

posted by Sebastien Jourdain at Nov 6, 2007 11:32 AM