Subversion Quick Start Guide for CS162

Revision History:
Thomas Kho, tkho@eecs, 9/11/2007

Subversion is "like CVS but better" (it solves many of the technical problems and annoyances with CVS). If you have any comments or issues please let us know.

Setting up a repository

  1. The Nachos code is already checked into your repository's trunk. There's nothing special to do for setup.

Basic Subversion Usage (Command-Line)

Note: If you are familiar with CVS, Subversion's commands are very similar and you should have no trouble at all.

  1. First, check out a local copy of the Nachos code:

    svn co https://isvn.eecs.berkeley.edu/cs162/group1/trunk/nachos

    This will create a nachos directory with all of the Nachos code in it.

    We have setup the recommended Subversion repository layout for you. Under your directory root, there are three directories: trunk, branches, and tags. These are for your group's working project, specific changes to test code, and labelling versions of your trunk, respectively.

  2. Edit your local copy of the files.

  3. When you are ready to make your changes available to other members of your group, commit the changes back to the repository:

    svn commit

    This will start up an editor for you to enter a log entry describing your changes. It makes a lot of sense enter a descriptive entry of the changes you made -- this will make tracking changes a lot easier.

    Note that you cannot commit changes unless your local files are up to date: that is, that you have been editing the most recent copy. See the next step for details.

  4. For other users to see the changes, they need to do:

    svn update

    which will update their local files to be in sync with the repository.

    If there are conflicts (that is, someone else edited the same file while you were in the process of editing it), you will be notified at this point and given a chance to fix the conflict. You will not be able to do a commit until you resolve the conflict. In order to fix a conflict, you edit the conflicting file, which will contain new lines with both the old and new versions. Decide which version you want to keep (or merge them somehow).

    svn update and svn commit list all the files they touch preceded by a one-character code signifying the change. Here is a quick key to the code:

  5. To add a file or directory to the repository, just do:

    svn add filenames...

    After svn add you need to svn commit for the addition to take effect.

  6. To remove a file from the Subversion repository:

    svn rm filename
    svn commit

Troubleshooting

Other Subversion Features

You can check out copy of code as it looked at a given time:

svn co -r '{2005-02-10}' nachos

Subversion does not have a separate tag namespace (as you may be used to in CVS). Instead, tree copies are efficient in time and space. If you have a good, working version of the code and want to tag it as such, you can do:

svn cp https://isvn.eecs.berkeley.edu/cs162/group1/trunk/nachos https://isvn.eecs.berkeley.edu/cs162/group1/tag/nachos-phase1-submission

Later, you can check out the exact version of that code:

svn co https://isvn.eecs.berkeley.edu/cs162/group1/tags/nachos-phase1-submission This is also useful for tagging each of your submissions.

You can also look at a 'diff' of changes from one version of the code to another:

svn diff -r '{2004-07-17}'
svn diff -r PREV foo.java

Also, the svn log command will show you the log entries for each version of files in the tree, so you can eyeball the changes that were made over time.

Type svn help to get a lot more information on using this wonderful tool.

Downloading software

Caveats!

Generally it is best to only check in source files to the repository -- anything that can be generated (say, a Java .class file) should not be checked in, since it's redundant (and confusing if the generated .class files don't match up with the source files).