Sources of information

subversion.tigris.org - the subversion project home page.
Version Control with Subversion - online O'Reilly book (appears to be the official documentation for the project).

Installing

Subversion 1.4 is supplied with Slackware 11. However, Subversion 1.5 seems to have some nice extras (e.g. better handling of conflicts), so I downloaded and installed that. Installation is the usual:

cd subversion-1.5.4
./configure
make
vim description-pak
checkinstall
upgradepkg subversion-1.5.4-i486-1fog.tgz

Converting a CVS repository

An existing CVS repository can be converted to an SVN repository using cvs2svn. This is a Python script, so it doesn't need building (or installing) - simply download, unpack, and run from the directory you unpacked it to.

cvs2svn uses an "options" file to configure the conversion. There is template options file (called 'cvs2svn-example.options') supplied - I copied that to a file called 'options', and made the following changes:

123c123
<     r'/path/to/svnrepo', # Path to repository
---
>     r'/var/svn/repos', # Path to SVN repository
219,220c219,220
<         #'utf8',
<         'ascii',
---
>         'utf8',
>         #'ascii',
227,228c227,228
<         #'utf8',
<         'ascii',
---
>         'utf8',
>         #'ascii',
230c230
<     #fallback_encoding='ascii'
---
>     fallback_encoding='ascii'
237,238c237,238
<         #'utf8',
<         'ascii',
---
>         'utf8',
>         #'ascii',
405,406c405,406
<     DefaultEOLStyleSetter(None),
<     #DefaultEOLStyleSetter('native'),
---
>     #DefaultEOLStyleSetter(None),
>     DefaultEOLStyleSetter('native'),
496c496
<     r'test-data/main-cvsrepos',
---
>     r'/var/cvs/REPOSITORY',   # Path to CVS repository

The repository paths are for the old (CVS) repository and the new (SVN) repository. The SVN repository directory should not exist prior to running cvs2svn. cvs2svn does not modify the CVS repository, although the instructions recommend making a backup of it first.

The changes from ascii to utf8 are because my default character encoding is UTF8.

The DefaultEOLStyleSetter change causes files to be treated as text files unless they have been explicitly flagged as binary. If you have any binary files in the CVS repository, you should flag them as binary using the command 'cvs admin -kb file' before running cvs2svn. Note that any files that require non-standard treatment of newlines (e.g. CR/LF line-endings, or omission of final newline) should also be flagged as binary. If you fail to flag a binary file before conversion, you can correct the flagging in the SVN repository using the commands:

svn propset svn:mime-type application/octet-stream file
svn propdel svn:keywords file
svn propdel svn:eol-style file

You should also copy and re-commit the file itself if it has got corrupted in the conversion process.

To perform the conversion, use the command:

cvs2svn --options=options

On sage, I've created a special user 'svn' to own and manage the SVN repository, so I did 'su - svn' before running the above command.

You can do a "dry run" of the conversion using the command:

cvs2svn --options=options --dry-run

although it's easy to delete the newly-created SVN repository if you want to do the conversion again.

subversion server

If your subversion client is on the same machine as the repository, you can access the repository using commands like:

svn list file://localhost/var/svn/repos/trunk

But if you want to access the repository from a remote machine, you will probably want an SVN server running on the repository machine. It's possible to use Apache 2 as an SVN server, but it's simpler to use svnserve - the server supplied in the subversion distribution. To start the server, use the command:

svnserve -d -r /var/svn/repos

on the repository machine, where /var/svn/repos is the path to the repository. You can then access the repository remotely (and locally) using commands like:

svn list svn://sage/trunk

On sage, I've put the following command in /etc/rc.d/rc.local to automatically start svnserve (running as user svn):

su - svn "/usr/local/bin/svnserve -d -r /var/svn/repos"

There are lots of things one can do to control access to the repository. I edited the file conf/svnserve.conf, uncommenting the line 'password-db = passwd' in order to use the default password file 'conf/passwd'. I then added the lines 'fog = ' and 'monica = ' to the 'conf/passwd' file - this allows us both to log in without a password. I did consider allowing anonymous users to write to the repository, but then changes would not be labelled with the user that made them.

If you do use svnserve (in daemon mode, as above) it's probably best to stick to that method of access (i.e. always 'svn:', and never 'file:', 'http:' or 'svn+ssh:'), since it simplifies issues of file ownership and permissions in the repository.

Using subversion

Using subversion is similar to using CVS, but there are differences - most notably:
The Basic Usage chapter of the book looks to be a good introduction to using subversion. The most useful commands appear to be:

Miscellany

*.c = svn:eol-style=native
*.cpp = svn:eol-style=native
*.cc = svn:eol-style=native
*.h = svn:eol-style=native
*.java = svn:eol-style=native
*.xml = svn:eol-style=native
*.html = svn:eol-style=native
*.css = svn:eol-style=native
*.php = svn:eol-style=native
*.inc = svn:eol-style=native
*.sh = svn:eol-style=native;svn:executable
*.txt = svn:eol-style=native
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
*.gif = svn:mime-type=image/gif
Makefile = svn:eol-style=native
svn commit foo
svn log foo             # shows the commit
svn log                 # does NOT show the commit
svn update
svn log                 # now shows the commit

The explanation is that the working copy of the directory containing foo is still on an old revision number after the commit, and 'svn log' only displays changes up to that revision number. The 'svn update' updates the working copy of the directory to the same revision as foo.
cd ....                            # Change to the directory that you want to set the property on.
svn update                         # Make sure the directory is up-to-date.
svn propedit svn:ignore .          # Enter the names of the files to be ignored, one per line.
svn propget svn:ignore             # Check that it looks OK. The files should be listed on separate lines.
svn commit .                       # Commit the change.
rm foo                             # No longer needed.

You can repeat the 'svn propedit' whenever you want to add more files or remove some.