From 3abd8c62bbbe1391fba2d72b90f5f8f1dc11d5cf Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 28 Aug 2015 02:06:26 +0000 Subject: [PATCH] updated the post-commit hook to include the commit message in the notification email --- codepot/etc/post-commit.in | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/codepot/etc/post-commit.in b/codepot/etc/post-commit.in index 28eceb96..c3e14178 100644 --- a/codepot/etc/post-commit.in +++ b/codepot/etc/post-commit.in @@ -168,6 +168,28 @@ sub get_author return $author; } +sub get_commit_message +{ + my $pool = SVN::Pool->new(undef); + my $svn = eval { SVN::Repos::open ($REPOFS, $pool) }; + if (!defined($svn)) + { + print (STDERR "Cannot open svn - $REPOFS\n"); + return undef; + } + + my $fs = $svn->fs (); + if (!defined($fs)) + { + print (STDERR "Cannot open fs - $REPOFS\n"); + return undef; + } + + my $author = $fs->revision_prop ($REV, 'svn:log'); + return $author; +} + + sub format_string { my ($fmt, $userid, $password) = @_; @@ -399,9 +421,16 @@ if (lc($cfg->{commit_notification}) eq 'yes') } else { - $commit_message = 'See ' . format_commit_url($cfg->{commit_notification_url}, $REPOBASE, $AUTHOR, $REV); + $commit_message = format_commit_url($cfg->{commit_notification_url}, $REPOBASE, $AUTHOR, $REV); } + my $m = get_commit_message (); + if (defined($m)) + { + $commit_message = $commit_message . "\n" . $m; + } + + email_message_to_project_members ($cfg, $dbh, $cfg->{database_prefix}, $REPOBASE, $commit_subject, $commit_message); }