Introduction

[http://subversion.tigris.org/ Subversion] aka SVN [http://packages.debian.org/subversion (Debian package)] is a version control system that is a compelling replacement for CVS in the open source community.

It has many features and improvements with respect to CVS, but most important ones are:

Basic commands and usage

Projects must start: svn import

Each project must start its life in SVN by an import command. It is recomended that each project should have a structure that would allow branching and tagging in a convenient manner; see the chapter [http://svnbook.red-bean.com/nightly/en/svn.reposadmin.projects.html#svn.reposadmin.projects.chooselayout choosing repository layout] more info.

svn import -m "New import" localprojdir svn+ssh://svn.debian.org/svn/aliothproj/path/in/project/repository

After the initial import, the surce just used for the import should be removed and a checked out version should be used for further modifications.

Summary:

Getting a working copy: svn checkout

Once the project is in subversion, a developer can get a copy of it by using the checkout command. This is necessary so subversion can track your local changes. Usualy one would want to get the most recent version from trunk, but in some cases one would want to check out a branch. Checking out a branch is no different from checking out from trunk, one will use the svn checkout command.

svn checkout svn+ssh://developer@svn.debian.org/svn/aliothproj/trunk

Now you can make your modifications to the checked out directory.

Note: Checking out a single file is not possible, only directories can be checked out.

Summary:

Checking status: svn status

You made modification, but you want to see a summary of the local copy's status.

svn status

Summary:

Checking modifications: svn diff

You have found out that a file has some mofications since it was synced with the repository. Seeing the contents of the change can be done with svn diff.

svn diff

Saving your changes: svn commit

You have seen what changed and you decide is time to make your changes public to do that, use svn commit

svn commit -m "made foo changes to current directory"

If no parameter is specified, the current directory's (and subdirectories') changes are committed in subversion. The commit can be done also on a "per file" basis by specifing the names of the files/subdirectories to have their changes committed.

svn commit -m "made foo changes to some_modified_file" some_modified_file

Summary:

Branching and tagging: svn copy

From time to time it is necessary to isolate a certain snapshots (usualy from trunk) of the project. This might be the case if in a project a release is wanted or a certain feature is to be developed in a branch.

Subversion does not distinguish between copying, tagging and branching and all of them can be accomplished through the usage of the copy command.

svn copy -m "Tag release 0.4" svn+ssh://svn.debian.org/svn/aliothproj/trunk svn+ssh://svn.debian.org/svn/aliothproj/tags/0.4

Summary:

Basic work cycle

The SVN book [http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html describes] very well the basic working cycle; more informations are available [http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html there].

Tips and tricks