A compendium of SVN incantations to do common or important tasks.

## To check out a directory from the repository to create a working copy

This command checks out the MMJ-Depot into the current directory:

> svn checkout svn+ssh://128.32.122.217/svn/cnmat/trunk/max/patches/MMJ-DEPOT

###

With SC Plugin you go to the Finder, create a new (empty) directory where you want your working directory to be. Open the new directory. Right-click in the blank whiteness. Go to "svn" then "add..." from the submenu. This will bring up a dialog box where you'll confirm what folder will become a working directory, enter the "repository URL", and then click.

A "repository URL" says how to get to which svn server, which repository, and which subdirectory or file, like this one for the entire MMJ-Depot:

> svn+ssh://128.32.122.217/svn/cnmat/trunk/max/patches/MMJ-DEPOT

### If you're on Feldman

If for some unlikely reason you need to work on the Subversion server itself, you can use "svn" from the command line, like this:

> svn checkout file:///svn/cnmat/trunk/max/patches/MMJ-DEPOT

## To see the version history of a file

Go to the directory in your working copy that contains the file.

> svn log -v foo.c | more

This gives you the entire history of the given file, including the revision numbers (of the entire repository) for each different version of the file, who committed each revision when, and the log messages.

## To compare a file with a different version of itself

You'll need to look at the version history of the file to select which repository revisions you want to compare. This example compares the version of SDIF-info.c in repository revisions 106 and 222:

> svn diff -r 106:222 SDIF-info.c

Note that in this context the "-r" flag stands for "revision"; with regular Unix "diff" -r stands for "recursive".

## To see what's changed in the MMJ Depot since the last release

Go to the [cnmat:downloads|Downloads page] and click on the "details" link next to the MMJ Depot. In the resulting details that come up, find the line that says something like "Revision: $LastChangedRevision: 1602 $". That tells you that the current released version of the MMJ Depot corresponds to SVN repository revision number 1602.

Now go to your working copy of the MMJ Depot and ask for a log of everything that's changed between revision 1602 and the current (which is called the "head" in SVN parlance):

> svn log -v -r 1602:HEAD MMJ-DEPOT

## To go back to an old version of a file

Suppose you want file foo.c as of repository revision 420. First see if you have any unsaved edits:

svn diff foo.c

If so, you'd better commit them, save them in a temporary file, or decide that you want to get rid of them.

Now you can delete your current version of the file and go back to an old one:

rm foo.c
svn update foo.c -r 420