«

»

Jul 01

Automated Setup of Subversion Repository

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.

Permanent link to this article: http://blog.curioussystem.com/2010/07/automated-setup-of-subversion-repository/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>