Installing Subversion-to-web

Requirements

Subversion-to-web requires the following command-line programs:

If using ftp or sftp to upload files:

You will also need full access to your subversion server.

Installation

Check out the latest svn2web code onto your Subversion server. A good place to put the files would be /usr/share/svn2web, so check out the code (as root) like this:
root@host # cd /usr/share
root@host # svn co https://svn2web.svn.sourceforge.net/svnroot/svn2web/trunk svn2web

You need to execute the svn2web script (previously uncompressed) from your pre-commit hook script. The hooks directory is "root_of_repository/hooks", and the name must be "pre-commit". The pre-commit script must also be executable. Also, the hook MUST set an appropriate PATH.

Here's an example pre-commit "hook" script. Note that we have added the location of the installation directory into the PATH, in this case /usr/share/svn2web

#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/share/svn2web
svn2web $1 $2 >> /tmp/svn2web.log || exit 1
exit 0

Usage

Now the hook script is in place and the svn2web tools are installed on your server, it's time to try it out!

Add an "svn2web" property to the branch or directory that should get copied, like this example (don't forget the "." at the end of the svn propset line).

  cd trunk
  svn propset svn2web "sftp:username:password@machine:/path" .
  svn commit -m "Upload commits to server."

Use:

If a branch/directory should get copied multiple places, use svn propedit and list each on a separate line.

Also, note that if a sub-directory has the svn2web property set, then that setting OVERRIDES the parent's setting.

The put_ftp/put_sftp/remove_ftp/remove_sftp files must be executable, and must be in the same directory as the svn2web utility.

Subversion-to-web synchronises your subversion repository with your remote content by only copying over changes, so before you commit any changes, first check that your remote content is the same as the current content in your subversion repository.

Now you're ready to try and make a change. When you issue an "svn commit" you should find that any files you change will be copied to the remote machine. Deletions and additions will also be synchronised, but the time-stamp on any unchanged files will remain the same.