How to set up Subversion (SVN)

Create a Repository

The following is a very basic walkthrough for creating a Subversion repository for source control. For more information, please see the documentation. Subversion 1.4 should be installed on all department RHEL5 machines.

To create a repository in a folder called svn in your home directory on a CS machine, run:

cd; svnadmin create svn

Create a directory for your project:

svn mkdir file:///your/home/directory/svn/projectname/ -m "Project root
for projectname"

Create a directory for the trunk (main work branch) of your code:

svn mkdir file:///your/home/directory/svn/projectname/trunk/ -m "Creating trunk"

Similarly you can (should) create tags/ and branches/ directories.

Import your code into the repository:

svn import /path/to/your/projectcode file:///your/home/directory/svn/projectname/trunk/ -m "Initial import for projectname"

You will now need to check out a new working copy:

svn checkout file:///your/home/directory/svn/projectname/trunk/

This will create a directory named trunk (which you can rename) with a working copy of the project in the repository.

cd trunk

Using version control

From here you can make changes and use the various svn commands. Use

svn help

to get help with commands, or look here for help.

The main commands you will need are:

svn up

to update the working copy from the repository.

svn commit

to put changes in the working copy into the repository.

svn status

to list the status of changed files in the working copy.

svn add

to add a new file to version control. Status will now show an A next to it. You will need to commit to actually put it in the repository.

Using the repository remotely

You can access your repository from outside the CS network over ssh. Replace file:// in the above commands with svn+ssh://username@somepubliccsmachine.cs.brandeis.edu
For example, to get a working copy of your code on your home machine:

svn checkout svn+ssh://username@somepubliccsmachine.cs.brandeis.edu/your/home/directory/svn/projectname/trunk/

Within the working copy you can use commands (e.g. svn commit) the same as above.


Valid XHTML 1.0
Strict

Last modified: 2008-05-13

guru@cs.brandeis.edu