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

Alex Vandiver alexmv at bestpractical.com
Sat Dec 3 09:48:59 EST 2011


The branch, master has been updated
       via  073f2e0f942b98500d8b306a929f87a8e5543119 (commit)
       via  3dc0e71b44bd670744f1dbbe57baa19dc2976215 (commit)
       via  a37a37943a3f4e91475b06a73342c2afc51fbe56 (commit)
       via  41bfabbd54169195f909400dadfdeb111bb22dfa (commit)
       via  34d91872326ff6817e070ecff93b006ea622fe39 (commit)
      from  411ff430b1a4427879fbfa648a4cc713c7fe52ed (commit)

Summary of changes:
 lib/Smokingit/Model/Branch.pm                |   10 +++++++---
 lib/Smokingit/Model/Commit.pm                |    2 +-
 lib/Smokingit/Model/SmokeResultCollection.pm |   15 +++++++++++++++
 lib/Smokingit/View/Branch.pm                 |    4 ++--
 lib/Smokingit/View/Project.pm                |   23 +++++++++++++++++++++++
 5 files changed, 48 insertions(+), 6 deletions(-)
 create mode 100644 lib/Smokingit/Model/SmokeResultCollection.pm

- Log -----------------------------------------------------------------
commit 34d91872326ff6817e070ecff93b006ea622fe39
Author: Alex Vandiver <alex at chmrr.net>
Date:   Fri Dec 2 19:01:26 2011 -0500

    Ignore blob fields (i.e. "aggregator") when doing a smoke result search
    
    Loading them takes a non-trivial amount of time, even for small result
    sets.  Since the complete result aggregator is only used in the
    individual smoke result page, this is a clear win.

diff --git a/lib/Smokingit/Model/SmokeResultCollection.pm b/lib/Smokingit/Model/SmokeResultCollection.pm
new file mode 100644
index 0000000..b65247d
--- /dev/null
+++ b/lib/Smokingit/Model/SmokeResultCollection.pm
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+
+package Smokingit::Model::SmokeResultCollection;
+use base qw/Smokingit::Collection/;
+
+sub implicit_clauses {
+    my $self = shift;
+    my @cols = map {$_->name}
+      grep {!$_->virtual and !$_->computed and $_->type ne "blob"}
+	$self->record_class->columns;
+    $self->columns(@cols);
+}
+
+1;

commit 41bfabbd54169195f909400dadfdeb111bb22dfa
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sat Dec 3 09:46:39 2011 -0500

    Ignore unnecessary columns when prefetching smoke results on commits
    
    This requires Jifty::DBI 203f8bb to work.

diff --git a/lib/Smokingit/Model/Branch.pm b/lib/Smokingit/Model/Branch.pm
index b1c2d0f..42fa92d 100644
--- a/lib/Smokingit/Model/Branch.pm
+++ b/lib/Smokingit/Model/Branch.pm
@@ -229,9 +229,12 @@ sub commit_list {
         value    => $self->project->id
     );
     $commits->prefetch(
-        name => "smoke_results",
-        alias => $results,
-        class => "Smokingit::Model::SmokeResultCollection",
+        name    => "smoke_results",
+        alias   => $results,
+        class   => "Smokingit::Model::SmokeResultCollection",
+        columns => [qw/id gearman_process configuration_id
+                       error is_ok exit wait
+                       passed failed parse_errors todo_passed/],
     );
     my %commits;
     $commits{$_->sha} = $_ while $_ = $commits->next;

commit a37a37943a3f4e91475b06a73342c2afc51fbe56
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sat Dec 3 09:48:09 2011 -0500

    Prefetch smoke results and commit data on branch tips for project lists
    
    This makes the number of queries on the project page no longer O(n) in the number of branches.

diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index 3c11e7e..2314c81 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -89,7 +89,7 @@ sub run_smoke {
 
 sub hash_results {
     my $self = shift;
-    my $results = $self->prefetched( "smoke_results" );
+    my $results = shift || $self->prefetched( "smoke_results" );
     unless ($results) {
         warn "$self does not have smoke_results prefetched!\n";
         return;
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index 8f1cfed..391fe05 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -142,10 +142,33 @@ sub branchlist {
     my ($branches, %args) = @_;
     $branches->order_by( column => "name" );
     if ($branches->count) {
+        $branches->prefetch( name => "current_commit" );
+        my $results = $branches->join(
+            type    => "left",
+            alias1  => "main",
+            column1 => "current_commit_id",
+            table2  => "smoke_results",
+            column2 => "commit_id",
+            is_distinct => 1,
+        );
+        $branches->limit(
+            leftjoin => $results,
+            column   => "project_id",
+            value    => get('project_id'),
+        );
+        $branches->prefetch(
+            name    => "smoke_results",
+            alias   => $results,
+            class   => "Smokingit::Model::SmokeResultCollection",
+            columns => [qw/id gearman_process configuration_id
+                           error is_ok exit wait
+                           passed failed parse_errors todo_passed/],
+        );
         div { class is "hline"; }
             if $args{hline};
         ul {
             while (my $b = $branches->next) {
+                $b->current_commit->hash_results( $b->prefetched("smoke_results") );
                 li {
                     { class is $b->test_status; }
                     hyperlink(

commit 3dc0e71b44bd670744f1dbbe57baa19dc2976215
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sat Dec 3 09:48:42 2011 -0500

    Skip unnecessary LOWER(...) calls on status

diff --git a/lib/Smokingit/Model/Branch.pm b/lib/Smokingit/Model/Branch.pm
index 42fa92d..7821d85 100644
--- a/lib/Smokingit/Model/Branch.pm
+++ b/lib/Smokingit/Model/Branch.pm
@@ -28,6 +28,7 @@ use Smokingit::Record schema {
     column status =>
         type is 'text',
         is mandatory,
+        is case_sensitive,
         valid_values are [
             { value => "ignore",         display => "Ignore" },
             { value => "hacking",        display => "Being worked on" },

commit 073f2e0f942b98500d8b306a929f87a8e5543119
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sat Dec 3 09:48:50 2011 -0500

    Indentation nit

diff --git a/lib/Smokingit/View/Branch.pm b/lib/Smokingit/View/Branch.pm
index 9014850..88c5a62 100644
--- a/lib/Smokingit/View/Branch.pm
+++ b/lib/Smokingit/View/Branch.pm
@@ -50,8 +50,8 @@ template '/branch' => page {
         class is "commitlist biglist";
         for my $commit (@commits) {
             $commit->hash_results;
-           my $merge = $commit->subject =~ /^Merge branch /
-               ? "merge" : "nonmerge";
+            my $merge = $commit->subject =~ /^Merge branch /
+                ? "merge" : "nonmerge";
             div {
                 {class is "$merge commit ".$commit->status};
                 for my $config (@configs) {

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



More information about the Bps-public-commit mailing list