Project

General

Profile

Subversion post-commit hook and Redmine bridge

Added by Erdem C over 10 years ago

Hi all,

Right now we are working on several projects with the support of Redmine.
We've successfully integrated subversion and other modules with our development process.

We decided to inform our developers whenever there is a commit in our svn.
We can use post-commit hook successfully with manual email details.
What we want to do is; inform developers assigned to project in case of a commit.

Let me share my current code;

#!/bin/sh
#!/bin/env /var/www/html/script/rails

REPOS="$1"
REV="$2"

export RAILS_ENV="production"

var=$(/var/www/html/script/rails runner 'puts Project.find("raporlama-modulu").users.collect(&:mail).join(" --to ")')
var="--to $var"

/usr/local/bin/svnnotify --repos-path "$REPOS" --revision "$REV" --subject-cx $var --from

With this code we are trying to get the list of "that" project and notify them via svnnotify.

The problem is; we can run this script as a root but after commit system can not run the "Project.find" function and the email variable is emtpy.

We tried to trace and debug it but it seems we can not find a solution.

Can anyone help us on this issue ?

Thanks.


Replies (2)

RE: Subversion post-commit hook and Redmine bridge - Added by Anonymous over 10 years ago

You can easily do this with a cronjob and wget, just call

/usr/bin/wget -q "http://localhost:3000/sys/fetch_changesets?key=XXXXXXXXXXXXXXXXXXXXXXXXX" -O /dev/null -o /dev/null

maybe this helps?

RE: Subversion post-commit hook and Redmine bridge - Added by Erdem C over 10 years ago

Thank you for your suggestion.
But, as far as i know, fetch_changesets method only imports commits to the database.

What we are looking for is to inform developers about the commit.
As you can see from my code, i am trying to find related developers and send them the svn notify email.

Still waiting for comments.

Thanks.

    (1-2/2)