bashsvnsvn-hooks

Getting project name in post-commit subversion hook


I have a subversion repository laid out like this:

Repo
    ProjectA
        trunk
        branches
        tags
    ProjectB
        trunk
        branches
        tags

I'm trying to write a post-commit hook script that just applies to one project, but I just learned that they are housed at the root of the repository.

The only two parameters I get are the Repository path and Revision number. Is there any way for me to execute this script for just a particular project?

Thanks,

Solution: Ultimate solution went something like this:

#!/bin/bash
REPOS="$1"
REV="$2"
if svnlook changed -r $REV $REPOS | grep ProjectA; then
    echo "do stuff"
fi

Solution

  • yes, use svnlook to get the list of files modified in the committed revision, then grep on the names with a suitable regex to determine whether the path the post-commit contains your project name in the correct place, if it does execute the code, otherwise, jump to the end of the script and return 0.