开发者

How can I add a single post-commit for multiple repositories in subversion hooks

We have a subversion setup like /va开发者_运维知识库r/svn/repoA, /var/svn/repoB, /var/svn/repoC etc. We use Redmine for project management.

To automate some tasks like updating Redmine projects, we are using subversion post-commit hook.

As we have multiple repositories for multiple projects, when we need to implement a common hook for all projects in redmine, we edit all post-commit hooks inside multiple repositories. Definitely this is getting annoying and problematic.

I am trying to figure out if it is possible (and if so, how) to use a single post-commit hook for all the repositories.

Thanks.


use symbolic links to a single post-commit hook


We had a similar problem, the solution is ALMOST as good as having a single post-commit hook script. I wrote ONE single script that does all the Redmine integration stuff. This script takes as input the project identifier in Redmine. All we have to do now is to call the integration script from within the post-commit hook script, per repository, passing the Redmine project identifier. So, yes, each repository has to have its own post-commit hook, but is just a one-line call to another script with a parameter.

Con:

  • You will still have one post-commit hook per repository. HOWEVER, it's just a one-line script, passing the Redmine project identifier as a parameter. That's not going to change all the time is it?

Pros:

  • When there's change, you will only change the integration script. You will never touch the post-commit hooks

  • As time goes by, you might find yourself in need to perform different actions in different projects/repositories. That is doable with the presented approach. You don't get that kind of flexibility using the single post-commit hook approach. In the end, that's really why you have the post-commit hook per repository. You might even have a different issue tracker for some repository, right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜