1

We have a subversion setup like /var/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.

2 Answers2

2

use symbolic links to a single post-commit hook

Peter Parker
  • 29,093
  • 5
  • 52
  • 80
0

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?

Adriano Carneiro
  • 57,693
  • 12
  • 90
  • 123
  • isn't it like my current situation? If I adopt your solution, instead of modifying the individual post-commit hooks, I have to modify the individual integration script. Or I am missing something here? – Habib Ullah Bahar Apr 01 '11 at 04:55
  • I thought this is what you are looking for (changing only in one place one time and the change is available to all repositories), since you were looking for a "single post-commit hook" for all repository. AFAIK, the solution we use around here is as close as you can get to that. Hope that helps. – Adriano Carneiro Apr 01 '11 at 14:12