Project

General

Profile

granular svn post-commit hook

Added by Felix Schäfer almost 15 years ago

I don't really need help on this one, but neither of the other 2 forums seemed suitable, and maybe people looking for a post-commit hook will more likely end up here than in the other forums.

Anyway, this is an svn post-commit hook that will update the changesets in redmine only for the project the repository belongs to (provided the repository has the same name as the project's identifier, as e.g. created by the automatic reposman.rb script). Here is the script, I put mine in /path/to/your/redmine/directory/extra/svn/trigger_Redmine_fetch_changeset :

#!/usr/bin/env /path/to/your/redmine/directory/script/runner

Project.find_by_identifier(File.basename(ARGV[0])).repository.fetch_changesets

You will need to put something like this in your hooks/post-commit in your svn repository:

#!/bin/sh

REPOS="$1" 

RAILS_ENV="production" /path/to/your/redmine/directory/extra/svn/trigger_Redmine_fetch_changeset $1

This will automagically update the repository in redmine for the concerned project on each commit, making sure your Redmine is always up-to-date, and keeping even the Atom feeds in sync, without having to update each and every project after each commit on anyone of them.