Sazug
Sazug

Reputation: 382

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"?

Upvotes: 3

Views: 3566

Answers (2)

Bert Huijben
Bert Huijben

Reputation: 19612

I would recommend using a continuous integration server like CruiseControl.NET over using a post commit hook for integration tasks.

These tools can easily monitor your repository for changes below specific urls, but they don't have to be run with the same privileges as your subversion server. In particular they can never corrupt your repository. You can just run them on any (old) server, while you can run your repository on a more prominent/stable/backed up server.

Upvotes: 3

Peter Parker
Peter Parker

Reputation: 29715

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).

Upvotes: 3

Related Questions