From 55cbda7b5dd9d0de728726646ea08f06055f47b0 Mon Sep 17 00:00:00 2001 From: Neil Moore Date: Fri, 4 May 2012 21:26:10 -0500 Subject: Re-enable commit announcements. And change the format slightly. --- lib/Crawl/Bot/Plugin/Commit.pm | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/Crawl/Bot/Plugin/Commit.pm b/lib/Crawl/Bot/Plugin/Commit.pm index 70b7278..1172413 100644 --- a/lib/Crawl/Bot/Plugin/Commit.pm +++ b/lib/Crawl/Bot/Plugin/Commit.pm @@ -10,6 +10,12 @@ has repo_uri => ( default => 'git://gitorious.org/crawl/crawl.git', ); +has announce_commits => ( + is => 'rw', + isa => 'Bool', + default => 1, +); + has checkout => ( is => 'ro', isa => 'Str', @@ -83,21 +89,23 @@ sub tick { $self->say_all("New branch created: $branch ($nrev commits)"); } -# my %commits = map { $_, $self->parse_commit($_) } @revs; -# -# my $cherry_picks = @revs; -# @revs = grep { $commits{$_}->{subject} !~ /\(cherry picked from / -# && $commits{$_}->{body} !~ /\(cherry picked from / } @revs; -# $cherry_picks -= @revs; -# $self->say_all("Cherry-picked $cherry_picks commits into $branch") -# if $cherry_picks > 0; -# -# for my $rev (@revs) { -# my $commit = $commits{$rev}; -# my $abbr = substr($rev, 0, 12); -# my $br = $branch eq "master" ? "" : "$branch "; -# $self->say_all("$commit->{author} $br* r$abbr ($commit->{nfiles} changed): $commit->{subject}"); -# } + if ($self->announce_commits) { + my %commits = map { $_, $self->parse_commit($_) } @revs; + + my $cherry_picks = @revs; + @revs = grep { $commits{$_}->{subject} !~ /\(cherry picked from / + && $commits{$_}->{body} !~ /\(cherry picked from / } @revs; + $cherry_picks -= @revs; + $self->say_all("Cherry-picked $cherry_picks commits into $branch") + if $cherry_picks > 0; + + for my $rev (@revs) { + my $commit = $commits{$rev}; + my $abbr = substr($rev, 0, 12); + my $br = $branch eq "master" ? "" : "[$branch] "; + $self->say_all("$commit->{author} $br* $abbr ($commit->{nfiles} changed): $commit->{subject}"); + } + } $self->head($branch => $head); } -- cgit v1.2.3-54-g00ecf