[Bps-public-commit] smokingit branch, anna, updated. 0d535c2b3990fed4273ab5d66dc1866e05a07db2
Thomas Sibley
trs at bestpractical.com
Mon Jun 17 15:05:40 EDT 2013
The branch, anna has been updated
via 0d535c2b3990fed4273ab5d66dc1866e05a07db2 (commit)
from bde0a2d9e85a0597ed04e072441898cdf82fae29 (commit)
Summary of changes:
lib/Smokingit/IRC.pm | 50 ++++++++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 20 deletions(-)
- Log -----------------------------------------------------------------
commit 0d535c2b3990fed4273ab5d66dc1866e05a07db2
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Jun 17 12:05:16 2013 -0700
Include the queue position in the "status" command if the status is queued
diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index bd90155..3b1c17d 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -111,7 +111,12 @@ sub do_status {
my $incoming = shift;
my $what = $self->lookup_commitish($incoming, @_);
if ($what->isa("Smokingit::Model::Commit")) {
- return $incoming->reply( $what->short_sha . " is " . $what->status );
+ my $msg = $what->short_sha . " is " . $what->status;
+
+ $msg .= "; " . $self->queue_status($what)
+ if $what->status eq "queued";
+
+ return $incoming->reply( $msg );
} else {
return $what;
}
@@ -210,28 +215,33 @@ sub do_queued {
my $count = $queued->count;
my $msg = "$count test". ($count == 1 ? "" : "s") ." queued";
- if ($what) {
- my ($before, $found) = (0, undef);
- while (my $test = $queued->next) {
- $found = 1, last if $test->commit->sha eq $what->sha;
- $before++;
- }
- my $short = $what->short_sha;
- if ($found) {
- if ($before == 0) {
- $msg .= "; $short first in line";
- } elsif ($before == 1) {
- $msg .= "; $short up next";
- } else {
- $msg .= "; $before test".($before == 1 ? "" : "s")
- . " before $short";
- }
+ $msg .= join(" ", ";", $what->short_sha, $self->queue_status($what, $queued))
+ if $what;
+
+ return $incoming->reply($msg);
+}
+
+sub queue_status {
+ my ($self, $commit, $queued) = @_;
+ $queued ||= Smokingit::Model::SmokeResultCollection->queued;
+
+ my ($before, $found) = (0, undef);
+ while (my $test = $queued->next) {
+ $found = 1, last if $test->commit->sha eq $commit->sha;
+ $before++;
+ }
+
+ if ($found) {
+ if ($before == 0) {
+ return "first in line";
+ } elsif ($before == 1) {
+ return "up next";
} else {
- $msg .= "; $short not queued!";
+ return "behind $before test".($before == 1 ? "" : "s");
}
+ } else {
+ return "not queued!";
}
-
- return $incoming->reply($msg);
}
sub test_progress {
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list