summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-02-15 03:03:09 -0600
committerJesse Luehrs <doy@tozt.net>2010-02-15 03:03:09 -0600
commitf28465652f05e585cbb3adda87176436b8384e79 (patch)
treedc46210e6dda2fec7093051e6b896f1d1a19834f
parentf919b440a12f5c31fe55d3b683e90702eb0ac5b0 (diff)
downloadcrawlbot-f28465652f05e585cbb3adda87176436b8384e79.tar.gz
crawlbot-f28465652f05e585cbb3adda87176436b8384e79.zip
minor fixes to the commit plugin
-rw-r--r--lib/Crawl/Bot/Plugin/Commit.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Crawl/Bot/Plugin/Commit.pm b/lib/Crawl/Bot/Plugin/Commit.pm
index 7993271..8e74115 100644
--- a/lib/Crawl/Bot/Plugin/Commit.pm
+++ b/lib/Crawl/Bot/Plugin/Commit.pm
@@ -7,7 +7,7 @@ extends 'Crawl::Bot::Plugin';
has repo_uri => (
is => 'ro',
isa => 'Str',
- default => 'git://crawl-ref.git.sourceforge.net/gitroot/crawl-ref/crawl-ref ',
+ default => 'git://crawl-ref.git.sourceforge.net/gitroot/crawl-ref/crawl-ref',
);
has checkout => (
@@ -20,10 +20,10 @@ has checkout => (
mkdir $checkout unless -d $checkout;
my $dir = pushd($checkout);
if (-f 'HEAD') {
- system('git fetch ' . $self->repo_uri);
+ system('git fetch');
}
else {
- system('git clone --bare ' . $self->repo_uri . " $checkout");
+ system('git clone --mirror ' . $self->repo_uri . " $checkout");
}
$checkout;
},
@@ -47,10 +47,11 @@ has heads => (
sub tick {
my $self = shift;
my $dir = pushd($self->checkout);
- system('git fetch ' . $self->repo_uri);
+ system('git fetch');
for my $branch ($self->branches) {
my $old_head = $self->head($branch) || '';
my $head = `git rev-parse $branch`;
+ chomp ($old_head, $head);
next if $old_head eq $head;
if (!$self->has_branch($branch)) {
@@ -63,7 +64,8 @@ sub tick {
my $cherry_picks = @revs;
@revs = grep { $commits{$_}->{body} !~ /\(cherry picked from / } @revs;
$cherry_picks -= @revs;
- $self->say_all("Cherry-picked $cherry_picks commits into $branch");
+ $self->say_all("Cherry-picked $cherry_picks commits into $branch")
+ if $cherry_picks > 0;
for my $rev (@revs) {
my $commit = $commits{$rev};
@@ -83,6 +85,7 @@ sub branches {
sub parse_commit {
my $self = shift;
my ($rev) = @_;
+ my $dir = pushd($self->checkout);
my $info = `git log -1 --pretty=format:%aN%x00%s%x00%b%x00 $rev`;
$info =~ /(.*?)\0(.*?)\0(.*?)\0(.*?)/;
my ($author, $subject, $body, $stat) = ($1, $2, $3, $4);