.comment-link {margin-left:.6em;}

IntTech

Thursday, March 19, 2009

Subversion Repository Script on Mac OS

Following the instructions from Apple Developer Center in this document about Subversion with Xcode 3. I wrote the following shell script to simplify my steps in creating a repository. I caution you that is does MINIMAL error checking.

#!/bin/sh
# Check if SVN_REPOSITORY is set
if [ "$SVN_REPOSITORY-X" == "-X" ]; then
SVN_REPOSITORY="/Library/subversion/repository"
fi

if [ -r /tmp/$1 ]; then
echo "/tmp/$1 exists - exiting";
exit;
fi

echo "Creating repository for $1"
svnadmin create $SVN_REPOSITORY/$1
mkdir -p /tmp/$1/trunk /tmp/$1/branches /tmp/$1/tags
svn import /tmp/$1 file:///$SVN_REPOSITORY/$1 -m "Project Create"

echo "Created $1 - cleaning up"
rm -rf /tmp/$1

chown -R www:admin $SVN_REPOSITORY
chmod -R ug+rwX,o= $SVN_REPOSITORY

I placed in in /usr/local/bin/, so that it would be in my path on the Mac command line. You can set the environment variable SVN_REPOSITORY to your repository location or it assumes the spot I used, /Library/subversion/repository.

Bookmark and Share

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home


Google