Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Provide a link to git output
Hopefully this will demonstrate what is happening more clearly.

Also, refactor away annoying say() calls.
  • Loading branch information
AlexDaniel committed Jul 14, 2016
1 parent dcb3929 commit ddd9684
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
12 changes: 11 additions & 1 deletion Perl6IRCBotable.pm
Expand Up @@ -36,7 +36,7 @@ use JSON::XS;

use constant RAKUDO => './rakudo';
use constant BUILDS => abs_path('./builds');
use constant CONFIG => './config.json';
use constant CONFIG => abs_path('./config.json');
use constant SOURCE => 'https://github.com/perl6/bisectbot';

my $name = 'Perl6IRCBotable';
Expand Down Expand Up @@ -191,6 +191,16 @@ sub said {
}
}

sub tell {
my ($self, $message, $text) = @_;
$self->say(
channel => $message->{channel},
body => $text,
who => $message->{who},
address => 1,
);
}

sub help {
"Like this: $name: f583f22 say 'hello'; say 'world'";
}
Expand Down
27 changes: 11 additions & 16 deletions bisectable.pl
Expand Up @@ -99,23 +99,13 @@ sub process_message {
}
my $output_file = '';
if ($exit_good == $exit_bad) {
$self->say(
channel => $message->{channel},
body => "Exit code is $exit_bad on both starting points, bisecting by using the output",
who => $message->{who},
address => 1,
);
$self->tell($message, "Exit code is $exit_bad on both starting points, bisecting by using the output");
(my $fh, $output_file) = tempfile(UNLINK => 1);
print $fh $out_good;
close $fh;
}
if ($exit_good != $exit_bad and $exit_good != 0) {
$self->say(
channel => $message->{channel},
body => "Exit code on a 'good' revision is $exit_good (which is bad), bisecting with inverted logic",
who => $message->{who},
address => 1,
);
$self->tell($message, "Exit code on a 'good' revision is $exit_good (which is bad), bisecting with inverted logic");
}

my $oldDir = cwd();
Expand All @@ -126,16 +116,21 @@ sub process_message {
system('git', 'bisect', 'start');
system('git', 'bisect', 'good', $full_good);
system('git', 'bisect', 'bad', $full_bad);
my $bisect_status;
my ($bisect_output, $bisect_status);
if ($output_file) {
$bisect_status = system('git', 'bisect', 'run', $commit_tester, $self->BUILDS, $filename, $output_file);
($bisect_output, $bisect_status) = $self->get_output('git', 'bisect', 'run',
$commit_tester, $self->BUILDS, $filename, $output_file);
} else {
if ($exit_good == 0) {
$bisect_status = system('git', 'bisect', 'run', $commit_tester, $self->BUILDS, $filename);
($bisect_output, $bisect_status) = $self->get_output('git', 'bisect', 'run',
$commit_tester, $self->BUILDS, $filename);
} else {
$bisect_status = system('git', 'bisect', 'run', $commit_tester, $self->BUILDS, $filename, $exit_good);
($bisect_output, $bisect_status) = $self->get_output('git', 'bisect', 'run',
$commit_tester, $self->BUILDS, $filename, $exit_good);
}
}
$self->tell($message, 'bisect log: ' . $self->upload({ 'query' => $body,
'result' => $bisect_output }));
if ($bisect_status != 0) {
chdir($oldDir);
return "'bisect run' failure";
Expand Down

0 comments on commit ddd9684

Please sign in to comment.