24.5. Introduction to Subversion

Subversion is a free open source versioning control system and is widely regarded as the successor to CVS, meaning that features already introduced for CVS are normally also in subversion. It is especially recommended when the advantages of CVS are sought without having to put up with its disadvantages. Many of these features have already been briefly introduced in 24.1.3. “subversion”.

24.5.1. Installing a Subversion Server

The installation of a repository database on a server is a relatively simple procedure. Subversion provides a dedicated administration tool for this purpose. The command to enter for creating a new repository is:

svnadmin create /path/to/repository

Other options can be listed with svnadmin help. As opposed to CVS, subversion is not based on RCS, but rather on the Berkeley Database. Make sure not to install a repository on remote file systems, like NFS, AFS, or Windows SMB. The database requires POSIX locking mechanisms, which these file systems do not support.

The command svnlook provides information about an existing repository.

svnlook info /path/to/repository

A server must be configured to allow different users to access the repository. Either use the Apache web server with WebDAV to do this or use svnserve, the server packaged with subversion. Once svnserve is up and running, the repository can be accessed with a URL with svn:// or svn+ssh://. Users that should authenticate themselves when calling svn can be set in /etc/svnserve.conf.

A decision for Apache or for svnserve depends on many factors. It is recommended to browse the subversion book. More information about it can be found in 24.5.3. “For More Information”.

24.5.2. Usage and Operation

Use the command svn (similar to cvs) to access a subversion repository. The content provided by a correctly configured server fitted with a corresponding repository can be accessed by any client with one of the following commands:

svn list http://svn.example.com/path/to/project


svn list svn://svn.example.com/path/to/project

Save an existing project in the current directory (check it out) with the command svn checkout:

svn checkout http://svn.example.com/path/to/project nameofproject

Checking out creates a new subdirectory nameofproject on the client. Operations (adding, copying, renaming, deleting) can then be performed on it:

svn add file
svn copy oldfile newfile
svn move oldfile newfile
svn delete file

These commands can also be used on directories. subversion can additionally record properties of a file or directory:

svn propset license GPL foo.txt

The preceding example sets the value GPL for the property license. Display properties with svn proplist:

svn proplist --verbose foo.txt
 Properties on 'foo.txt':
 license : GPL

Save the changes to the server with svn commit Another user can incorporate your changes in his working directory by synchronizing with the server using svn update.

Unlike CVS, the status of a working directory in subversion can be displayed without accessing the repository with svn status. Local changes are displayed in five columns, with the first one being the most important one:


No changes.


Object is marked for addition.


Object is marked for deletion.


Object was modified.


Object is in conflict.


Object was ignored.


Object is not being maintained by versioning control.


Object is reported missing. This flag appears when the object was deleted or moved without the svn command.


Object was being maintained as a file but has since been replaced by a directory or the opposite has occurred.

The second column shows the status of properties. The meaning of all other columns can be read in the subversion book.

Use the command svn help to obtain the description of a parameter of a command:

svn help proplist
proplist (plist, pl): List all properties on files, dirs, or revisions.
usage: 1. proplist [PATH...]
       2. proplist --revprop -r REV [URL]

  1. Lists versioned props in working copy.
  2. Lists unversioned remote props on repos revision.

24.5.3. For More Information

The first point of reference is the home page of the subversion project at http://subversion.tigris.org/. A highly recommendable book can be found in the directory file:///usr/share/doc/packages/subversion/html/book.html after installation of the package subversion-doc and is also available online at http://svnbook.red-bean.com/svnbook/index.html.