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

Alex Vandiver alexmv at bestpractical.com
Tue Feb 8 14:23:01 EST 2011


The branch, master has been updated
       via  2ad6092cb1c6714a908d313a94d05daf84504112 (commit)
       via  eee96fe0f7eb873440c53414641208b1abfc9040 (commit)
      from  d4843295baee50f969f9e044ca2926f01313a12d (commit)

Summary of changes:
 lib/Smokingit/Model/Commit.pm |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit eee96fe0f7eb873440c53414641208b1abfc9040
Author: Alex Vandiver <alex at chmrr.net>
Date:   Tue Feb 8 14:22:43 2011 -0500

    ->status returns a list, which was confusing things; split ou the individual ->status calls

diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index fbaec35..7cdccf1 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -158,15 +158,19 @@ sub status {
     } elsif ($self->{status}) {
         return $self->{status};
     } else {
-        my %results;
+        my @results;
         if (exists $self->{results}) {
-            $results{$_}++ for map {$self->status($_)} values %{$self->{results}};
+            @results = values %{$self->{results}};
         } else {
             my $smoked = Smokingit::Model::SmokeResultCollection->new;
             $smoked->limit( column => "commit_id", value => $self->id );
             $smoked->limit( column => "project_id", value => $self->project->id );
-            $results{$self->status($_)}++
-                while $_ = $smoked->next;
+            @results = @{$smoked->items_array_ref};
+        }
+        my %results;
+        for my $result (@results) {
+            my ($status) = $self->status($result);
+            $results{$status}++;
         }
         for my $st (qw/broken errors failing todo passing parsefail testing queued/) {
             $self->{status} ||= $st if $results{$st};

commit 2ad6092cb1c6714a908d313a94d05daf84504112
Author: Alex Vandiver <alex at chmrr.net>
Date:   Tue Feb 8 14:22:56 2011 -0500

    Beter short-circuiting of commit status

diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index 7cdccf1..71bcc02 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -173,9 +173,9 @@ sub status {
             $results{$status}++;
         }
         for my $st (qw/broken errors failing todo passing parsefail testing queued/) {
-            $self->{status} ||= $st if $results{$st};
+            return $self->{status} = $st if $results{$st};
         }
-        return $self->{status} ||= "untested";
+        return $self->{status} = "untested";
     }
 }
 

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



More information about the Bps-public-commit mailing list