ECE Subversion (SVN) Server

Maintained by Bernie Roehl, Eric Praetzel, and Derek Rayside.

Contents


Courses with Subversion Repositories


Using a Subversion Repository

Subversion Clients

Mental Model

Workflow and Terminology

Different version control systems use different terminology and have different workflows. For example, Git and Perforce differ from Subversion. % With Subversion you will typically `checkout' only once, at the begging of term. % Then each time you sit down to work you will `update' before commencing coding. % When you are done work for that session, or at any other time the fancy strikes you, you will `commit' your changes. There are a few reasons why you want to update at the beginning of every work session. % First, if you have done work on another computer or in another working copy, then update will pull those changes to your current computer (assuming that you committed them from the other computer). % Second, the course staff may periodically patch the files to make changes to support future labs or to correct bugs.

Pitfalls

Some problems that we have observed students experiencing unnecessarily.

Administering a Subversion Repository

Getting Started

  1. Grant yourself read and write permission to your repository. By default nobody, not even you, has access to the data in the repository. Edit the ~/svn_repository.access file and add two lines like this at the bottom of it:

    [/]
    userid = rw

  2. Check out your repository, e.g.:

    svn co /ecesvn.uwaterloo.ca/people/userid

  3. Create the top-level repository structure. See suggestions below.

Repository structure suggestion for individuals:

Repository structure suggestion for courses:

We suggest that you make a top-level directory for each offering of a course so that future instructors will have access to the old materials. This is helpful for new instructors.

Permission Basics

You can grant read or write access to paths in your repository by editing your permissions file (~/svn_repository.access). For example, suppose you are collaborating with some friends on projectX:

[/projectX]
friend1 = rw
friend2 = rw

Defining Groups of Users

You can define your own groups of users at the top of your svn_repository.access file (just under the automatically inserted header). This is particularly useful for teaching. For example, we might define the following groups for the first offering of a course in 2012:

staff-2012a = drayside, broehl, epraetzel
students-2012a = vmontagh, m22ma, s26stewa

Permissions for Individual Student Directories in a Course Repository

When you make an individual directory for each student in a course repository you'll probably want to create permissions rules like this:

[/2012/students/drayside]
drayside = rw
@students-2012 = 

If you are comfortable with Bash scripts you can copy/paste/modify the following script to make a rule for each student:

#!/bin/bash

# help message
if [ $# == 0 ] ; then
    echo "There are two ways to run this script:"
    echo "1. Specify a list of student userids on the command line."
    echo "    e.g.: ./generate-student-rules.sh vmontagh m22ma s26stewa"
    echo "2. Specify a file name that contains a list of student userids."
    echo "    e.g.: ./generate-student-rules.sh students.txt"
    exit
fi

# figure out where to get list of student ids from
if [ -f $1 ] ; then
    # take student list from file
    students=`cat $1`
else
    # take student list from command line
    students=$*
fi

# generate the rules
# modify this part to specify the directory you are interested in
# and the student group name for this offering
for s in $students ; do
    echo "[/2012/students/$s]"
    echo "$s = rw"
    echo "@students-2012 = "
    echo ""
done

Permissions to working around a bug in some Subversion clients

Some Subversion clients have a bug that causes them to unnecessarily request read access to the root of the repository. To work around this, simply grant everyone read access to the root of the repository:

[/]
* = r

This rule in fact allows any user to read the entire repository, not just the root directory of the repository. To prevent everyone from having access to everything, you add a rule to each of the top-level directories that denies access:

[/2012]
* = 

Pre-defined groups of users and their recommended usage

Your svn_repository.access file contains a header that is maintained the ECE technical staff. This header includes definitions for user groups such as:

We recommend that you use these groups to grant read access to other instructors. Suppose that we are setting the permissions for the top-level directory for the first offering of a course in 2012, which we call 2012a. Suppose further that we have defined groups staff-2012a and students-2012a that includes the staff and students for this offering. The permissions on the top-level directory for this offering might look like:

[/2012a]
@staff-2012a = rw
@students-2012a = r
@ece-faculty = r
@se-faculty = r
@nano-faculty = r
@lab-instructors = r
* = 

Where things are Located

Trouble-shooting: everyone is denied access to everything

If you have a typo in your rules then Subversion will deny access to everyone.