[Bps-public-commit] smokingit branch, master, updated. ff91f9f6a020cd2acc9af4bf34a9f8b996f04fb8

Alex Vandiver alexmv at bestpractical.com
Mon Jan 31 10:54:50 EST 2011


The branch, master has been updated
       via  ff91f9f6a020cd2acc9af4bf34a9f8b996f04fb8 (commit)
       via  ade52c62004a1bb55900159c4792440df19b473a (commit)
       via  7ee9dbbc3c4d04d42abec318e91002a9a57505f1 (commit)
      from  7310a127b02f685ee9647083bd50a35203ce528b (commit)

Summary of changes:
 lib/Smokingit/Model/Commit.pm |   57 ++++++++++++++++++++++++++++------------
 lib/Smokingit/View/Branch.pm  |   14 +++++-----
 lib/Smokingit/View/Project.pm |    3 +-
 3 files changed, 49 insertions(+), 25 deletions(-)

- Log -----------------------------------------------------------------
commit 7ee9dbbc3c4d04d42abec318e91002a9a57505f1
Author: Alex Vandiver <alex at chmrr.net>
Date:   Mon Jan 31 10:53:25 2011 -0500

    Allow calling ->commit(SmokeResult) in addition to ->commit(Config)

diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index 755ba87..49005af 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -84,15 +84,22 @@ sub run_smoke {
 
 sub status {
     my $self = shift;
-    my $config = shift;
+    my $on = shift;
 
-    if ($config) {
+    if ($on) {
         my $result = Smokingit::Model::SmokeResult->new;
-        $result->load_by_cols(
-            project_id => $self->project->id,
-            configuration_id => $config->id,
-            commit_id => $self->id,
-        );
+        if ($on->isa("Smokingit::Model::SmokeResult")) {
+            $result = $on;
+        } elsif ($on->isa("Smokingit::Model::Configuration")) {
+            $result->load_by_cols(
+                project_id => $self->project->id,
+                configuration_id => $on->id,
+                commit_id => $self->id,
+            );
+        } else {
+            die "Unknown argument to Smokingit::Model::Commit->status: $on";
+        }
+
         if (not $result->id) {
             return ("untested", "");
         } elsif ($result->gearman_process) {

commit ade52c62004a1bb55900159c4792440df19b473a
Author: Alex Vandiver <alex at chmrr.net>
Date:   Mon Jan 31 10:54:17 2011 -0500

    Better commit status, based on "first of these smokeresult statuses"

diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index 49005af..3ee6920 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -133,19 +133,19 @@ sub status {
         } else {
             return ("failing", "Unknown failure");
         }
+    } elsif ($self->{status}) {
+        return $self->{status};
     } else {
+        my %results;
         my $smoked = $self->smoked;
-        my $passing = 0;
-        if ($smoked->count) {
-            while (my $smoke = $smoked->next) {
-                next if $smoke->gearman_process;
-                return "failing" unless $smoke->is_ok;
-                $passing++;
-            }
-            return $passing ? "passing" : "testing";
+        while (my $s = $smoked->next) {
+            my ($st) = $self->status($s);
+            $results{$st}++;
         }
-
-        return "untested";
+        for my $st (qw/broken errors failing parsefail todo passing testing queued/) {
+            $self->{status} ||= $st if $results{$st};
+        }
+        return $self->{status} ||= "untested";
     }
 }
 
diff --git a/lib/Smokingit/View/Branch.pm b/lib/Smokingit/View/Branch.pm
index 8415354..09a333c 100644
--- a/lib/Smokingit/View/Branch.pm
+++ b/lib/Smokingit/View/Branch.pm
@@ -62,18 +62,18 @@ template '/branch' => page {
                         );
                     }
                 }
-                if ($commit->status =~ /^(failing|passing)$/) {
+                if ($commit->status =~ /^(untested|testing|queued)$/) {
+                    span {
+                        { class is "sha" };
+                        $commit->short_sha
+                    }
+                } else {
                     hyperlink(
                         tooltip => $commit->status,
                         class => "sha",
                         url => "/test/".$commit->sha."/",
                         label => $commit->short_sha,
                     );
-                } else {
-                    span {
-                        { class is "sha" };
-                        $commit->short_sha
-                    }
                 }
                 span {{class is "subject"} $commit->subject };
             };

commit ff91f9f6a020cd2acc9af4bf34a9f8b996f04fb8
Author: Alex Vandiver <alex at chmrr.net>
Date:   Mon Jan 31 10:54:38 2011 -0500

    Add a more readable "long status" on commits

diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index 3ee6920..39d33bb 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -149,6 +149,22 @@ sub status {
     }
 }
 
+sub long_status {
+    my $self = shift;
+    my %long = (
+        untested => "Untested",
+        queued   => "Queued for testing",
+        testing  => "Running tests",
+        passing  => "Passing all tests",
+        todo     => "TODO tests unexpectedly passed",
+        parse    => "Parse failures!",
+        failing  => "Failing tests!",
+        errors   => "Configuration errors!",
+        broken   => "Unknown failure!"
+    );
+    return $long{$self->status};
+}
+
 sub smoked {
     my $self = shift;
     my $config = shift;
diff --git a/lib/Smokingit/View/Branch.pm b/lib/Smokingit/View/Branch.pm
index 09a333c..b824a6b 100644
--- a/lib/Smokingit/View/Branch.pm
+++ b/lib/Smokingit/View/Branch.pm
@@ -69,7 +69,7 @@ template '/branch' => page {
                     }
                 } else {
                     hyperlink(
-                        tooltip => $commit->status,
+                        tooltip => $commit->long_status,
                         class => "sha",
                         url => "/test/".$commit->sha."/",
                         label => $commit->short_sha,
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index f0205a4..6c5695a 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -179,7 +179,8 @@ template '/cooking.txt' => sub {
         my $sub = $t->branches;
         while ($b = $sub->next) {
             $out .= " "x 4 . $b->name." - ".$b->owner . "\n";
-            $out .= " "x 6 . "[ " . $b->display_status;
+            $out .= " "x 6 . "[ " . $b->current_commit->long_status;
+            $out .= " - " . $b->display_status;
             $out .= " by ". $b->review_by if $b->status eq "needs-review" and $b->review_by;
             $out .= " ]\n";
             my $long = Text::Wrap::wrap(" "x 8," "x 8,$b->long_status);

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list