SVN post-update hook per project?
It appears that post-update 开发者_Python百科hooks apply to the entire SVN setup on a machine, but I'm looking to set individual hooks per project. From what I can see, you set up your hooks in settings, which is global.
Any idea as to how I can pull off post-update hooks per project?
Its simple really - put code (a regex for the project path) in your hook that does nothing if its not the project you wanted to hook.
If you need to know the repository path of the updated working copy, use svninfo.
The first parameter of the post-commit hook is the path to the repository which means as mentioned before use a regex to filter out the project your like to do things with.
I ran into this a little while ago, but in reverse; I was applying hooks to project repositories but some of them were identical, and it seemed inefficient to apply them redundantly. As it was, the practice of creating projects in SVN wasn't good practice: each project was given a repository in the root (the root couldn't have hooks applied to it.)
In my case, the fix was to have a central repository with project trees falling under that, which meant I could apply my hooks to the, say, Client
repo and have it cascade so it was applied to all projects under that root. This become much more effective, as I could then section projects off and apply per-repo-type hooks without redundancy.
In your case, what I think you want is the other way around, so in essence each project needs to be a repository, not just part of the root repository.
精彩评论