Project

General

Profile

Actions

Feature #3667

open

granular post-commit hook

Added by Felix Schäfer over 14 years ago. Updated over 13 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-07-24
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

I have written a commit-hook that will fetch changes only for the project with the same name as the svn repository, see http://www.redmine.org/boards/2/topics/7633 for the full discussion, code copied here:

$ cat /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

$ cat /path/to/your/svn/directory/identifier/hooks/post-commit
#!/bin/sh

REPOS="$1" 

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

This will obviously only work if the svn repo has the same name as the identifier of your project, but that is given if created with reposman.rb. I haven't integrated my git with redmine yet, but I think the script could be made to work with a git project by just adding something like ARGV[0].chomp!("/") .chomp!(".git") (think the space away, I'd get an image markup from the !s without it...) before the call to Project and passing GIT_DIR to the script.

Anyway, I figured I'm not the only one who would like to get a post-commit triggered refresh without having to wait for ages because redmine sorts through all repositories, maybe this should go in extra/svn/ or maybe in the wiki?

Actions

Also available in: Atom PDF