Department of Computer Science University of San Francisco

Computer Science 625-01
Setting Up and Using Subversion
Spring 2014

Subversion is an open source revision control system. It's used primarily for keeping a record of a software development project. In CS 625 we'll use it to provide a convenient location for storing programming projects. Note that you must use the directory structure outlined here for your projects.

Subversion consists of four main components: a server computer, the Subversion server software, a client computer, and the Subversion client software. The basic idea is you do your work (e.g., programming) on whatever computer is convenient -- the client. A special CS department server stores a copy of your work. When you modify an assignment, you use the client software to tell the server software to update the copy stored on the server. In addition to storing the latest version of the assignment, the server will store all earlier versions of the assignment. So if, for example, you decide that the changes you just made to your assignment were a bad idea, you can retrieve an earlier version from the server.

All of the CS Department computers have Subversion installed in the Linux partition. However, if you're using your own computer, you may need to install a copy. Source and binary versions for most common architectures can be downloaded from

Each USF CS student has a subversion directory that can be accessed over the internet. It's located at
For example, if your CS user id is peter, it's accessible at
So once you are logged on to a machine with Subversion installed, you can create a subdirectory for cs625
   $ svn mkdir -m 'add 625 dir'

Note: In this document the dollar sign ($) denotes the shell-prompt. You shouldn't type it in. Of course, you need to replace "peter" with your actual CS user id.

Note: On CS department machines "" can be abbreviated to "www".

Subversion is somewhat fussy about documentation: pretty much every time you execute a subversion command that updates the subversion repository, it wants to know what you've done. You can deal with this by adding a string after '-m'. Alternatively, you can get Subversion to prompt you for the documentation string by throwing you into an editor. Before this will work, you'll need to tell Subversion which editor you use. I prefer vi. So I've added the following line to my .bash_profile file:

   export SVN_EDITOR=vi

You can see a record of the Subversion commands you've executed by typing

   $ svn log
   r1 | peter | 2011-01-25 13:44:48 -0800 (Tue, 25 Jan 2008) | 1 line

   add cs625 dir

Now change to the subdirectory of your home directory where you want your CS 625 programs to reside. For example,

   $ cd ~
and check out your CS 625 subversion repository
   $ svn co
This will create a cs625 directory, and you can create subdirectories of it for each of your programs:
   $ cd cs625
   $ mkdir prog1 prog2 prog3 prog4 prog5
   $ svn add *
   A         prog1
   A         prog2
   A         prog3
   A         prog4
   A         prog5
   $ svn commit -m "create program directories"
   Adding         prog1
   Adding         prog2
   Adding         prog3
   Adding         prog4
   Adding         prog5

   Committed revision 2.
   $ svn ls

Now just to be sure everything's fine, create a bogus prog1.c in the prog1 directory, add it and commit it.

   $ cd prog1
   $ cat > prog1.c
   #include <stdio.h>

   int main(void) {
      printf("hello, world\n");
      return 0;
   $ svn add prog1.c
   $ svn commit -m "create bogus prog1"
   Adding         prog1/prog1.c
   Transmitting file data .
   Committed revision 3.
   $ svn ls

You're set. Each time you finish an edit session, you should "commit" your changes, and each time you want to create a new file or directory, you should "add" the new file.

There's a lot more that you can do with Subversion. If you're interested check out the Subversion home
and the Subversion book

Peter Pacheco 2011-01-21