I've set up a repository to configure my websites, the repository is /subversion/web and at the moment I have just one website controlled in /subversion/web/mywebsite

I've set up a post-commit hook script that exports the site into a web directory on the server for testing before I publish it all separately and it works fine.

What I'd like to do is set the script so that I can control a second website in the same repository but only have 'mywebsite' export when I check in a file related to that project.

I've set it up this way because I access the repository from a number of computers via http, it makes it easier to create new projects without having to create a whole new repository and configure apache to point at it and all the rest of it.

latest svn running on latest ubuntu with latest apache2


You can do this using the "svnlook" command.

Here's an example post-commit hook:

/usr/bin/svnlook dirs-changed -r "$REV" "$REPOS" | egrep -q '^mywebsite'
if [ $? -eq 0 ] ; then
    # publish site code

You may need to run svnlook manually a few times to become familiar with the output and see how to set the match pattern for the grep.

  • brilliant, thank you – MalphasWats Feb 13 '10 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.