In this course, we will use Subversion for collaboration, version control, and project submission. This guide will show you everything you’ll need to use Subversion in this course.
Subversion is a version control system that keeps versions of your files in a “repository”, which we will provide for you on a server. The repository will enable you to retrieve (“checkout”, “update”) and store (“commit”) your files from multiple locations, and it will enable us to easily access your code for grading. It also provides a backup mechanism for you in case you ever need to revert to older versions of your code.
The Subversion client may be downloaded at:
Binaries for several systems such as Windows, Mac OS X, and Linux are available. If you have Windows, for example, you should the follow the link to “Windows binaries”. If you have Linux or Mac OS X, Subversion may be pre-installed.
You can confirm your Subversion installation by running it at your system’s command prompt:
$ svn help
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.6.5.
If you are not comfortable with a command-line interface, you may also wish to use a GUI front-end such as Tortoise SVN (Windows), svnx (Mac OS X), or RabbitVCS (Linux). It does not matter which interface you use, but it is your responsibility to become proficient with at least one.
You will use Subversion to (1) keep track of revisions as you work on your projects, and (2) submit your projects for grading. If you are in pair number P, then your repository is located at
You should svn checkout the above URL to create your local working directory. If you just want to view what files are there, you can also load it in a web browser (but you won’t be able to commit anything from the browser).
For each project N, you will create a directory in your local working directory named projectN containing each task in a separate file named M.whatever, where M is the task number. For example, if project 1 has two tasks, your repository should look like this:
If a given task requires more than one file, feel free to use a subdirectory for that task instead. Name the task subdirectory M, where M is the task number. Put all of the files you create for a given task in that task’s subdirectory. Also include a README file describing the purpose of each file and detailing how to run (if applicable) that task.
Whenever you want to push your changes to your repository, you will need to
svn commit them. (You will need to svn add them first—
You could then verify the current state of your work for assignment 1, for instance, by pointing your browser to
Just like the design recipe asks you to run tests at the end of a design cycle, you should check on your project on the server whenever you think you’re done.
You should commit all of your work every time you finish working on a task (and ideally more often). This ensures that we can track tasks within pairings, that you can prove your innocence in terms of code theft, and that you always have a backup of your work.
On the due date, an automated script will collect every pair’s current solution at the due time. Each time you commit an intermediate solution you’re guaranteeing yourself to have something available at the deadline. We will grade the code that we collect at the due time and ignore any revisions that you submit later. No exceptions.
Subversion commands are of the form:
$ svn verb [adverbs] [nouns]
The verb says what to do, such as to update or add information on a file. The optional adverbs say how to do it, for example -q for quietly or -N for non-recursively. The optional nouns are usually files or URLs on which to act.
There are two useful verbs that ask for information:
Display information for how to use svn. If verb is given, display information for how to use svn verb.
status [files and directories]
Display information about changes since your last commit to the repository. (Also see log and diff.)
There are various verbs for telling Subversion which files in your local directory it is responsible for. Here’s the most common one:
add [files and directories]
Places files and directories under Subversion’s control: the next time you commit they will be sent to the repository. If you add a directory, all files inside of that directory will also be added. (Also see rm, mkdir, mv, and cp.)
And there are several verbs for talking to the repository:
checkout repository-url [new-directory]
Makes a local copy of a repository. You only need to do this once per computer you want to work on.
update [files and directories]
Updates your local files with changes from the repository, merging if necessary.
This will print the current revision number of the repository. Note that this will increase quickly, since it is a global number for the entire class, not just for your pair.
Sometimes, when your partner has made changes to a file that you have also edited, Subversion will report a conflict. There are a number of ways to resolve conflicts, but the simplest way is for you and your partner to work together as a pair, so that conflicts do not arise at all.
commit [files and directories]
Push changes from the local copy into a new revision on the repository. Use the -m switch to give the revision a short description.
Subversion will refuse to commit if the repository has newer information than your local copy. In this case, update and try again.