Mark Assad : Documents: Subversion Guide

Subversion Overview

Mark Assad (27 April 2005)

Introduction

Subversion ( http://svnbook.red-bean.com/ , http://subversion.tigris.org/ ) is a free/open source version control system similar in style to CVS. It allows you to store a history of changes that you make to projects. All of this information gets stored in a single repository that can be accessed over a network. If you would like to know why subversion claims to be better than CVS, please read http://svnbook.red-bean.com/en/1.1/ch01s03.html .

Trac ( http://www.edgewall.com/trac/ ) is a combination of a Wiki and an issue tracking system, strongly liked to the subversion revision control system. Trac lets software project developers and users track, use and manage:

  1. software issues

  1. bug reports

  1. feature requests

  1. overall progress over time

  1. project tasks

  1. source code changes

  1. documentation / wiki text

Local Configuration

Locally subversion and trac are installed and running on praxis.it.usyd.edu.au using WebDAV over http/https. The repositories get backed up onto the staff tape backup system. Each project is stored in its own repository. Please ask if you’d like a repository set up. The examples in this document will use the SampleRes (sample) repository. Whenever you see sample in any of the following examples, replace it with the name of your own repository.

T he repositories are secured using normal HTTP basic authentication. At the moment a few accounts are setup using your staff login as both the userid. If you do not have an account, please ask and one can be created.

Quick Start

This section gives a quick run through of setting up a basic repository. It uses a hypothetical repository called sample , that is stored on praxis.it.usyd.edu.au . Accessing of the repository is done over http. This quick start is same as from the SVN Book, just customised to use the praxis server.

Create a tree of files and directories to import into  the repository. Your structure should contain three  top-level directories named branches,  tags, and  trunk:

/tmp/project/branches/

/tmp/project/tags/

/tmp/project/trunk/

               foo.c

               bar.c

               Makefile

Once you have a tree of data ready to go, import the data  into the repository with the svn import  command:

$ svn import /tmp/project http://praxis.it.usyd.edu.au/svn/sample -m "initial import"

Adding         /tmp/project/branches

Adding         /tmp/project/tags

Adding         /tmp/project/trunk

Adding         /tmp/project/trunk/foo.c

Adding         /tmp/project/trunk/bar.c

Adding         /tmp/project/trunk/Makefile

Committed revision 1.

$

Now the repository contains this tree of data. Note that  the original /tmp/project directory is  unchanged; Subversion is unaware of it. (In fact, you can even  delete that directory if you wish.) In order to start  manipulating repository data, you need to create a new  “working copy” of the data, a sort of private  workspace. Ask Subversion to “check out” a working  copy of the repository's trunk  directory:

$ svn checkout http://praxis.it.usyd.edu.au/svn/sample /trunk project

A  project/foo.c

A  project/bar.c

A  project/Makefile

Checked out revision 1.

Now you have a personal copy of part of the repository in a  new directory named project. You can edit  the files in your working copy and then commit those changes  back into the repository.

  1. Enter your working copy and edit a file's  contents.

  1. Run svn diff to see unified diff output of your changes.

  1. Run svn commit to commit the new  version of your file to the repository.

  1. Run svn update to bring your working  copy “up-to-date” with the repository.

  1. Run svn status to see what local files have changed compared with the repository.

There is also a Trac server associated with this repository at http://praxis.it.usyd.edu.au/projecs/sample

Basic Usage

help

Subversion has a lot of built-in help. To access this help type “ svn help ”.  You can find out the usage for subcommands by using “ svn help <subcommand> ”.

checkout

    svn checkout http://praxis.it.usyd.edu.au/svn/sample

Online TRAC web-based software project management

     http://praxis.it.usyd.edu.au/projects/sample

Ignore Files

    svn propedit svn:ignore elvin_sound/

Compare local copy to repository

    svn status

Commit local changes to repository

    svn commit [filename]

Download the latest version from the repository

    svn update

Adding a new file to the repository

    svn add <filename>