Search code examples
svnpost-commit

SVN post commit hook - find folder to which commit was done


Our repository has a structure like this:

Dev
    Project1
        source
        docs
        ...
    Project2
        source
        docs
        ...
    ...

After we commit changes to Project1 sources we would like to deploy Project1 (compile, test, copy, etc.). How to find out in post-commit-hook that we commited to Dev/Project1 so we could export this project and run some tasks on it? When commiting to svn (e.g. using TortoiseSVN) ir is written: "Commit to: ..." How to find that "commit to"?


Solution

  • You should use

    svnlook changed -r REV REPOPATH
    

    in a post-commit hook. SVN will provide REPOPATH and REV as arguments. You get a list with all changed paths back(new line separated). You can then easily use grep or anything else to search for the changed paths.

    Remember: start a new thread for building/deploying, as svn will wait until post-commit hook has finished(so you will not see "Committed Revision XX" until everything is deployed).