Automated Setup of Subversion Repository

 In bash, computers, version control

I may be unique in this respect, but I like to keep individual subversion repositories for each project. To make life a little easier in setting up the repository, I have a handy little bash script that sets up the repository with the /branch /trunk and /tags directories. This is nice so that I don’t forget to make them and have to clean things up later. So, without further adieu:
svn_default_repository:

#! /bin/bash
# (c) 2010 by Chad Kidder
# Licensed under the GPL 3.0
#This script sets up an initial SVN repository and
#Checks it out to the desired location
#
# Argument one is the location of the repository
# Argument two is where to check the repository out to

svnadmin create "$1"
fpath=file://$(readlink -f $1)
echo $fpath
svn mkdir "$fpath/trunk" "$fpath/branches" "$fpath/tags" -m "Laying out repository"
svn co "$fpath/trunk" "$2"

The real jewel in this one is the readlink command that will take a file/directory and tell you the full path. It even works with relative directory naming, something subversion can’t handle. Enjoy.

Leave a Comment

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Start typing and press Enter to search