Matthew West

Subversion Quick Reference

The best resources are the home page and the free online version of the O'Reilly book Version Control with Subversion.

Subversion is a centralized version control system. There is a single central repository running on a Subversion server, containing many projects. Creation of projects and access control of users to projects is done by the sysadmin.

Subversion comes with Fedora Linux and most other Linux distributions. On Mac OS X it can be installed via Fink. A Mac OS X graphical client is svnX. Under Windows Subversion can be installed as a command-line client as part of Cygwin, or with the native TortoiseSVN client that integrates with Windows Explorer.

Checking out a project for the first time

To access a project stored in a Subversion repository it must first be checked out. Assume that we have a project named proj stored on the server https://lagrange.mechse.illinois.edu/svn/. Then we should run:

svn checkout https://lagrange.mechse.illinois.edu/svn/proj

This will make a directory called proj containing the latest copy of the project files. You may need to provide a username and password, which can be obtained from the sysadmin (email sysadm@lagrange.mechse.illinois.edu). Your Subversion username and password are not the same as those used to log on directly to the machines.

The update/edit/commit cycle

The standard usage pattern with Subversion is:

The Subversion collaboration model works best when everyone updates and commits frequently. Always update before starting an editing session, and always commit once you are finished working for the day, or even more frequently.

Dealing with conflicts

If you see a C character for a file after running svn update or svn status then it indicates a conflict in that file. This occurs if both another user and you have edited the same portion of a file and Subversion was unable to automatically merge the changes.

In the event of a conflict there will be four files:

You need to use the contents of these files to update your copy of filename to include all of the changes from both you and the other users, adding or discarding changes as you wish. You then must run:

svn resolved <filename>

This tells Subversion that the conflict is resolved, and so it will let you commit again.

Other useful commands

Properties (binary files and EOL characters)

Each file in a Subversion repository has properties associated with it, which are arbitrary versioned metadata. To list, set or delete properties on a file do:

svn proplist --verbose <filename> svn
propset <property_name> <property_value> <filename> svn
propdel <property_name> <filename>

After you have set or deleted a property you must svn commit to send the change to the repository.

While you can set arbitrary properties on files, there are a number of properties which will change how Subversion behaves. The most important are: