Skip to main content
Department of Information Technology

Source Code Revision Control

Working on any project, it's always a good idea to use some kind of source code revision control system. Two popular for source code revision are Subversion and CVS.

Subversion

In the following examples, we assume a user on the Unix system with user name adam.

Create the repository

adam@hamberg: cd /home/adam
adam@hamberg: mkdir svn
adam@hamberg: svnadmin create /home/adam/svn/repos

Now you should have a new Subversion repository:

adam@hamberg:ls -l /home/adam/svn/repos/
conf/        dav/         db/          format       hooks/       locks/       README.txt

Import a Project

Suppose you have started a project with the following directory layout:

adam@hamberg: ls /home/adam/src/aibo
branches/  tags/      trunk/

This is the recommended directory layout for Subversion with a trunk directory to hold the "main line" of development, a branches directory to contain branch copies, and a tags directory to contain tag copies.

Lets assume you have the following files in the trunk:

adam@hamberg: ls  /home/adam/src/aibo/trunk
bar.c     foo.txt   README

You can now import the source tree:

adam@hamberg: svn import /home/adam/src/aibo file:///home/adam/svn/repos/some/project/name -m "Initial import"
Adding         /home/adam/src/aibo/trunk
Adding         /home/adam/src/aibo/trunk/foo.txt
Adding         /home/adam/src/aibo/trunk/bar.c
Adding         /home/adam/src/aibo/trunk/README
Adding         /home/adam/src/aibo/trunk/branches
Adding         /home/adam/src/aibo/trunk/tags

Committed revision 1.

This means you imported all files and directories found in {/home/adam/src/aibo} and placed them under the directory some/project/name within the repository. You can check that the import worked:

adam@hamberg: svn list file:///home/adam/svn/repos/some/project/name                    
branches/
tags/
trunk/
adam@hamberg: svn list file:///home/adam/svn/repos/some/project/name/trunk
README
bar.c
foo.txt
adam@hamberg:

Access the Repository

In the following examples we assume a user on one of the lab computers (Ubuntu) with user name eve.

The computers in the AIBO lab are not part of the same network as the UNIX-system. To access the repository we must tunnel over SSH using the svn+ssh:// URL scheme to connect:

eve@linux:  svn list svn+ssh://adam@hamberg.it.uu.se/home/adam/svn/repos/some/project
Password: 
README
bar.txt
foo.c
name/
eve@linux: 

Check Out a Project

Go to the directory to where you wish to create a working copy of the project:

eve@linux: cd /src/checkout

Check out the code:

eve@linux: svn checkout svn+ssh://adam@hamberg.it.uu.se/home/adam/svn/repos/some/project
Password: 
A    project/name
A    project/name/trunk
A    project/name/trunk/foo.txt
A    project/name/trunk/bar.c
A    project/name/trunk/README
A    project/name/branches
A    project/name/tags
A    project/bar.txt
A    project/foo.c
A    project/README
Checked out revision 1.

CVS

If you want to create a CVS-repository for temporary use or for a short time, as for example for this course, you can create a group CVS-repository on one of the team members UNIX account:

You might also find this page useful:

The CVS-server provided by the department (system support) is reserved for repositories with more long-term use like projects or when external users without UNIX-accounts must have access.

Updated  2010-01-19 16:32:58 by Karl Marklund.