CSE 120: Principles of Operating Systems (Summer, 2005)

Home | Syllabus | Schedule | Exams | Homework | Projects
Projects Home | Subversion

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 from your group's repositary:

           svn co http://cse120.textdriven.com/svn/cse120/group01/nachos 
          
    This will create a nachos directory with all of the Nachos code in it.

  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
          

  7. To turn in the projects:
    Make a turnin directory:

           svn mkdir http://cse120.textdriven.com/svn/cse120/groupXX/turnin
           svn mkdir http://cse120.textdriven.com/svn/cse120/groupXX/turnin/proj1 
          
    Copy the working files into the turnin directory:
    	svn copy http://cse120.textdriven.com/svn/cse120/groupXX/nachos http://cse120.textdriven.com/svn/cse120/groupXX/turnin/proj1
    	

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 http://cse120.textdriven.com/svn/cse120/groupXX/nachos http://cse120.textdriven.com/svn/cse120/groupXX/nachos-working1
  
Later, you can check out the exact version of that code:
    svn co http://cse120.textdriven.com/svn/cse120/groupXX/nachos-working1
  
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).