
To install SVN Hook Fork you will need to be able to edit the subversion hooks. You may also need to be able to change ownership/permissions of files so that the subversion server can write and execute them.
Get subversion and Python installed and working.
Get SVN Hook fork and install the files. We will be using /usr/local/bin for the executable and /etc for the configuration.
svn checkout http://svn.tepic.co.uk/svn/tools/svn-hook-fork cp svn-hook-fork/svn-hf-post-commit.py /usr/local/bin chmod +x /usr/local/bin/svn-hf-post-commit.py cp svn-hook-fork/demo-post-commit.cfg /etc/svn-hf-myrepo.cfg
Configure the subversion post commit hook to execute SVN Hook Fork
cd /svn-data-directory/myrepo/hooks cp post-commit.tmpl post-commit vi post-commit
Change the last line of post-commit to read (without the line break):
/usr/local/bin/svn-hf-post-commit.py /etc/svn-hf-myrepo.cfg "$REPOS" "$REV"
The demo configuration in svn-hook-fork/demo-post-commit.cfg contains example configuration values and documentation. Key configuration values are explained below:
Executable sections are denoted by regular expressions in square brackets - there are several examples in svn-hook-fork/demo-post-commit.cfg.
When a commit takes place each commited file is compared against each regular expressions and, if a match is found, the section executed. The executable code can be in any language executable by the shell, for example Python, Perl or Shell.
Within the executable code all occurances of $REPOS and $REV will be replaced by the repository and revision respectively.
In addition to the executable code the following SVN Hook Fork commands can be used:
This example sends a notification email whenever a commit occurs.
[.*] #!/bin/sh !email nat@example.com svnlook info $REPOS $REV
This example automatically rolls out changes in the GodWars II documentation to the live site.
[^www.tepic.co.uk/gw2docs/.*] #!/bin/sh cd /www/www.tepic.co.uk/htdocs/gw2docs /www/svn.tepic.co.uk/bin/svn up !email nat@tepic.co.uk !stop
If you have any question please ask me.
