Subversion: installation and usage
After CVS (which deserves its retirement), Subversion. The centralized VCS that bridged the gap between the commit-lock of CVS and the distributed model that would come after. The principle is simple: a central server (svnserve or Apache + mod_dav_svn), clients that checkout, commit, update. One history, one source of truth and a global revision number that increments on every commit.
Installation
apt-get install subversion subversion-tools
# Create the repository
svnadmin create /srv/svn/myproject
# Start the standalone server
svnserve -d -r /srv/svn
The svnserve mode is the simplest: no Apache, no mod_dav, a daemon listening on port 3690. For web access, you need Apache + mod_dav_svn (see the next article).
The checkout and workflow
# Initial checkout
svn checkout svn://myserver/myproject/trunk myproject
# Daily workflow
svn update
svn add new_file
svn commit -m "Description of the change"
svn status
svn diff
svn log
The workflow is checkout-commit-update: you checkout a local copy, you modify, you commit to the server. If someone committed before you, svn asks for an update before the commit. Conflicts are marked in the files (the famous <<<<<<< and >>>>>>> lines) and svn resolved marks them as resolved.
Branches
SVN branches are directories (cheap copies thanks to internal hard links):
svn copy svn://myserver/myproject/trunk \
svn://myserver/myproject/branches/my-branch \
-m "Creating the branch"
The merge is where SVN stumbles: svn merge works, but tracking merged revisions is manual (svnmerge.py helped before it was integrated). Git solved this with the commit graph and that is the main reason for the migration.
Hooks
SVN hooks are shell scripts in the repository’s hooks/ directory:
#!/bin/bash
# hooks/pre-commit: check the commit message
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
LOG=$($SVNLOOK log -t "$TXN" "$REPOS")
if [ ${#LOG} -lt 10 ]; then
echo "Commit message too short (10 characters minimum)." >&2
exit 1
fi
The pre-commit hook rejects the commit if the message is too short. Post-commit hooks trigger a build, send a mail, update a production repository via rsync. It is the ancestor of CI, in bash.
[edit: 2026] Subversion is still maintained by Apache (since the Tigris migration in 2010), still used in companies with 15-year SVN histories and no reason to migrate. The 2006 VCS landscape: CVS end-of-life, SVN rising, Mercurial and Bazaar emerging (both distributed like Git but simpler), Perforce in enterprise (the commercial VCS with licenses). Git arrived in 2005 (born from Linus’s need after losing BitKeeper access), but adoption took years. In 2008, SVN was the standard, Git was the newcomer, Mercurial was the closest competitor. History ruled, but SVN earned its decade.