SUBVERSION FOR COMPILER DESIGN STUDENTS: A CRASH COURSE

Non-HTML versions of this guide look much nicer: [pdf][ps]

Subversion is a version control system similar to CVS, and was designed by people who were annoyed by the shortcomings of CVS.

Quick Start

Log in to cvs.cs.mcgill.ca using ssh, then

svnadmin create /xtra/cs520-XX/repo

Replace XX by your two digit group number, and “repo” by whatever you feel like. Now, put some files in the repository

svn import projectdir file:///xtra/groupX/repo -m ”Initial import”

It helps if your project has the following directory structure:

projectdir/
 
projectdir/tags/
 
projectdir/branches/
 
projectdir/trunk/
=put your code here

You’ll see why once you’ve used subversion for a bit. After the initial import, check out your project with

svn checkout file://xtra/groupX/repo/trunk project

Where project will be the local directory name.

svn commands have the following syntax:

svn command [options] [args]

Very Useful Commands

(Familiar to those of us who’ve struggled with CVS before)

add         Adds files and directories.

blame       Shows detailed author and revision information for file(s).

commit      Send changes from working copy to the repository. 

delete      Delete item from working copy or repository.

export      Create a clean copy of the repository.

log         Display commit log messages.

move        Move a file or directory.

status      Print status of working copy.

diff        Display difference between working copy and remote repository.

update      Update working copy from repository.

You can also use svn from the labs or from home by substituting ”file:///” for ”svn+ssh://user@cvs.cs.mcgill.ca/”.

How to use

Here’s an example session, assuming that I’ve already created the repository with the svnadmin command on cvs.cs.mcgill.ca, and I’ve set up my project with the above directory structure. Try it to see what’s going on.

svn import joos svn+ssh://kwysoc@cvs.cs.mcgill.ca/xtra/group9/joos

[ I can now rm -rf joos since it’s on the cvs server]

svn checkout svn+ssh://kwysoc@cvs.cs.mcgill.ca/xtra/group9/joos/trunk joos

[ I can now work in the new joos directory. Some time passes. What have I changed?]

svn diff

[ Group members say they have commited some code. Let’s see what they did. ]

svn update

svn blame -r COMMITTED:HEAD *<

[ I’ve worked on the peephole optimizer for a bit time to let my group-mates know ]

svn commit -m ”Added some more optimizer patterns”

Resources

http://subversion.tigris.org/ - Main svn site

http://google.com - There is tons of help to be found, including quick reference cards.

svn help [command]