Set up SVN repo

Setting up a new SVN repo is not a VisIt topic per se but we do it from time to time to coordinate with collaborators and we usually end up forgetting some of the finer points that lead to headaches later. Setting up a new svn repo is mostly straightforward. When you end up sharing the repo with different users in a group, file permissions issues can come up if you do not set things up properly.

Setting up the repo

To set up the svn repo, you'll need a place where you want to store the svn repo and a place where you want to check it out to do actual work -- that's a separate directory from where the repo is stored.

# Set the name of the project that we'll set up.
export PROJECT=name

# Set up a central repos directory if you don't have a place.
cd
mkdir repos
mkdir repos/$PROJECT
cd repos/$PROJECT
svnadmin create svn

# Set up a checkouts directory, check out the project, and add a trunk/src directory.
cd
mkdir checkouts
cd checkouts
mkdir $PROJECT
cd $PROJECT
svn co file://$HOME/repos/$PROJECT/svn
cd svn
svn mkdir trunk
svn mkdir trunk/src
svn commit -m "Added trunk/src"

# Make a better checkout of just trunk/src
cd ~/checkouts/$PROJECT
rm -rf svn
svn co file://$HOME/repos/$PROJECT/svn/trunk/src
cd src

# Now you're ready to add new files using "svn add" and "svn commit" ...

Changing file permissions

When sharing the svn repo, you'll want to change the files so they are owned by a group that the users have in common. You will also need to set the setuid bit on all of the directories in the new svn repository's directory so commits by other users will result in new files that have group ownership rather than user ownership that messes up checkouts, etc.

# Set these accordingly.
export GROUP=group
export REPODIR=$HOME/repos/$PROJECT/svn

chgrp -R $GROUP $REPODIR
chmod -R g+rw $REPODIR
for f in `find $REPODIR -type d`; do
   chmod g+rwx $f
   chmod g+s $f
done