Quick Subversion (SVN) on Debian howto

Version of document: $Id: svn.php,v 1.10 2009/02/06 11:07:13 folkert Exp folkert $

Installing subversion

apt-get install libapache2-svn subversion

Creating a repository

Create repository on disk:
svnadmin create /data/nameofrepository
chown -R www-data /data/nameofrepository
Add repository to apache:
Add to /etc/apache2/mods-enabled/dav_svn.conf:
<Location /svn/nameofrepository>
  DAV svn
  SVNPath /data/nameofrepository/
  AuthType Basic
  AuthName "Subversion repository nameofrepository"
  AuthUserFile /etc/apache2/dav_svn.nameofrepository.passwd
     Require valid-user
Add user who is allowed to use the repository:
htpasswd /etc/apache2/dav_svn.nameofrepository.passwd myusername
Restart apache:
apache2ctl graceful

Import a fileset into the repository

svn import name_of_directory_with_files http://localhost/svn/nameofrepository/  -m "initial import description"

Using the repository

Creating a local working-copy

svn co http://localhost/svn/nameofrepository nameofdirtoputthefilesin

Adding a file

cd nameofdirtoputthefilesin
vi mynewfile
svn add mynewfile
svn commit mynewfile

Working on an existing file

svn update
vi myexistingfile
svn --username myusername ci myexistingfile -m "description of the changes"

Updating the local working-copy with the files from the repository

svn update

Viewing differences in a file against a previous version

svn diff -r version file
svn diff -r 10 msg.c

Adding RCS/CVS-style '$ Id $'-strings to your files

First enable them: svn propset svn:keywords "Date Author Id Revision" files
Then you can add things like:
/* $ Id $ */
as you could do with RCS/CVS.

The Lotter allows you to participate in lotteries from all over the world!