[Bps-public-commit] smokingit branch, master, updated. 3fee8b7d289c8051b168a7d1ab928b4790a9ecc0
Alex Vandiver
alexmv at bestpractical.com
Mon Jan 31 10:16:20 EST 2011
The branch, master has been updated
via 3fee8b7d289c8051b168a7d1ab928b4790a9ecc0 (commit)
via 7057d20017d7c815fcaede190c1efb503daba1e4 (commit)
via 27a71bd33ca2fc950099d0881edd49e297436f0e (commit)
via 484e0c72de6cbcb467766d68a24cc3298c712910 (commit)
via 84523a3029d184cca43cce9ae5024fac14dc3127 (commit)
from 898ba67c1f07d1df8df3a04838d8ab6d8a8c3fb2 (commit)
Summary of changes:
bin/local_updates | 14 ++++---
lib/Smokingit/Action/UpdateBranch.pm | 5 +--
lib/Smokingit/Dispatcher.pm | 62 ++++++++++++++++++----------------
lib/Smokingit/Model/Branch.pm | 12 ++++++
lib/Smokingit/Model/Project.pm | 7 ++++
lib/Smokingit/View/Project.pm | 33 +++++++++++++++---
6 files changed, 88 insertions(+), 45 deletions(-)
- Log -----------------------------------------------------------------
commit 84523a3029d184cca43cce9ae5024fac14dc3127
Author: Alex Vandiver <alex at chmrr.net>
Date: Mon Jan 31 09:11:07 2011 -0500
Actually list the smokeid if we fail
diff --git a/bin/local_updates b/bin/local_updates
index cb60515..b24cb0d 100755
--- a/bin/local_updates
+++ b/bin/local_updates
@@ -64,13 +64,14 @@ $worker->register_function(
# Find the smoke
Jifty->handle->begin_transaction;
+ my $smokeid = delete $result{smoke_id};
my $smoke = Smokingit::Model::SmokeResult->new;
- $smoke->load( delete $result{smoke_id} );
+ $smoke->load( $smokeid );
if (not $smoke->id) {
- warn "Invalid smoke ID: $result{smoke_id}\n";
+ warn "Invalid smoke ID: $smokeid\n";
return 0;
} elsif (not $smoke->gearman_process) {
- warn "Smoke report on $result{smoke_id} which wasn't being smoked?\n";
+ warn "Smoke report on $smokeid which wasn't being smoked? (last report at @{[$smoke->submitted_at]})\n";
return 0;
}
commit 484e0c72de6cbcb467766d68a24cc3298c712910
Author: Alex Vandiver <alex at chmrr.net>
Date: Mon Jan 31 09:11:33 2011 -0500
Return the number of smokes run
diff --git a/bin/local_updates b/bin/local_updates
index b24cb0d..5b3e234 100755
--- a/bin/local_updates
+++ b/bin/local_updates
@@ -173,6 +173,7 @@ $worker->register_function(
$configs->limit( column => "name", operator => "MATCHES", value => $configname )
if defined $configname and length $configname;
warn "Found @{[$configs->count]} configs\n";
+ my $tests = 0;
while (my $config = $configs->next) {
my %lookup = (
project_id => $commit->project->id,
@@ -185,19 +186,19 @@ $worker->register_function(
warn "Re-testing @{[$smoke->id]}\n";
$smoke->set_submitted_at(undef);
$smoke->set_gearman_process(undef);
- $smoke->run_smoke;
+ $tests += $smoke->run_smoke;
} elsif ($branch->id) {
$smoke->create(
%lookup,
from_branch_id => $branch->id,
);
warn "Smoking new @{[$smoke->id]}\n";
- $smoke->run_smoke;
+ $tests += $smoke->run_smoke;
} else {
warn "No existing smoke for $sha found, and no branch given\n";
}
}
- return 1;
+ return $tests;
},
);
commit 27a71bd33ca2fc950099d0881edd49e297436f0e
Author: Alex Vandiver <alex at chmrr.net>
Date: Mon Jan 31 09:28:05 2011 -0500
Support /projectname as a shortcut, merge in /sha, move catchalls last
diff --git a/lib/Smokingit/Dispatcher.pm b/lib/Smokingit/Dispatcher.pm
index 95705dd..087900d 100644
--- a/lib/Smokingit/Dispatcher.pm
+++ b/lib/Smokingit/Dispatcher.pm
@@ -63,22 +63,6 @@ under '/project/*' => [
},
];
-# Shortcut URLs, of /projectname/branchname
-on '/*/**' => run {
- my ($pname, $bname) = ($1, $2);
- my $project = Smokingit::Model::Project->new;
- $project->load_by_cols( name => $pname );
- return unless $project->id;
-
- my $branch = Smokingit::Model::Branch->new;
- $bname =~ s{/+}{/}g;
- $bname =~ s{/$}{};
- $branch->load_by_cols( name => $bname, project_id => $project->id );
- return unless $branch->id;
-
- redirect '/project/' . $project->name . '/branch/' . $branch->name;
-};
-
# Commits and test commits
under '/test/*' => [
run {
@@ -122,19 +106,40 @@ under '/test/*' => [
},
];
-# Shortcut URLs, of /sha
-on '/*' => run {
- my ($sha) = ($1);
- my $commits = Smokingit::Model::CommitCollection->new;
- $commits->limit( column => 'sha', operator => 'like', value => "$sha%" );
- return unless $commits->count == 1;
- redirect '/test/' . $commits->first->sha;
-};
-
-
# GitHub post-receive-hook support
on '/github' => run {
show '/github';
};
+# Shortcut URLs, of /projectname and /projectname/branchname and /sha
+under '/*' => [
+ run {
+ my $name = $1;
+ my $project = Smokingit::Model::Project->new;
+ $project->load_by_cols( name => $name );
+ if ($project->id) {
+ set project => $project;
+ return;
+ }
+
+ my $commits = Smokingit::Model::CommitCollection->new;
+ $commits->limit( column => 'sha', operator => 'like', value => "$name%" );
+ redirect '/test/' . $commits->first->sha
+ if $commits->count == 1;
+ },
+ on '' => run {
+ redirect '/project/'.get('project')->name.'/' if get('project');
+ },
+ on '**' => run {
+ my $bname = $1;
+ return unless get('project');
+ my $branch = Smokingit::Model::Branch->new;
+ $bname =~ s{/+}{/}g;
+ $bname =~ s{/$}{};
+ $branch->load_by_cols( name => $bname, project_id => get('project')->id );
+ redirect '/project/' . get('project')->name . '/branch/' . $branch->name
+ if $branch->id;
+ },
+];
+
1;
commit 7057d20017d7c815fcaede190c1efb503daba1e4
Author: Alex Vandiver <alex at chmrr.net>
Date: Mon Jan 31 10:15:44 2011 -0500
Refactor listing of branches and trunks
diff --git a/lib/Smokingit/Action/UpdateBranch.pm b/lib/Smokingit/Action/UpdateBranch.pm
index a54f728..e47b968 100644
--- a/lib/Smokingit/Action/UpdateBranch.pm
+++ b/lib/Smokingit/Action/UpdateBranch.pm
@@ -17,10 +17,7 @@ sub arguments {
my $args = $self->SUPER::arguments;
- my $branches = Smokingit::Model::BranchCollection->new;
- $branches->limit( column => 'project_id', value => $self->record->project->id );
- $branches->limit( column => 'status', value => 'master' );
- $branches->order_by( column => "name" );
+ my $branches = $self->record->trunks;
$args->{to_merge_into}{valid_values} = [
{
diff --git a/lib/Smokingit/Model/Branch.pm b/lib/Smokingit/Model/Branch.pm
index d856308..ed3552d 100644
--- a/lib/Smokingit/Model/Branch.pm
+++ b/lib/Smokingit/Model/Branch.pm
@@ -78,6 +78,18 @@ sub create {
return ($ok, $msg);
}
+sub branches {
+ my $self = shift;
+ my $branches = Smokingit::Model::BranchCollection->new;
+ return $branches unless $self->status eq "master";
+ $branches->limit( column => "project_id", value => $self->project->id );
+ $branches->limit( column => "status", operator => "!=", value => "ignore", entry_aggregator => "AND");
+ $branches->limit( column => "status", operator => "!=", value => "master", entry_aggregator => "AND");
+ $branches->limit( column => "to_merge_into", value => $self->id );
+ $branches->order_by( column => "name" );
+ return $branches;
+}
+
sub set_status {
my $self = shift;
my $val = shift;
diff --git a/lib/Smokingit/Model/Project.pm b/lib/Smokingit/Model/Project.pm
index 9c8e14c..7d08d61 100644
--- a/lib/Smokingit/Model/Project.pm
+++ b/lib/Smokingit/Model/Project.pm
@@ -86,6 +86,13 @@ sub branches {
return $branches;
}
+sub trunks {
+ my $self = shift;
+ my $trunks = $self->branches;
+ $trunks->limit( column => "status", value => "master" );
+ return $trunks;
+}
+
sub planned_tests {
my $self = shift;
my $tests = Smokingit::Model::SmokeResultCollection->new;
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index ce9cb3f..567cfa8 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -125,12 +125,7 @@ template '/fragments/project/branch-list' => sub {
label => $b->name,
url => "branch/" . $b->name,
);
- my $sub = Smokingit::Model::BranchCollection->new;
- $sub->limit( column => "project_id", value => get('project_id') );
- $sub->limit( column => "status", operator => "!=", value => "ignore", entry_aggregator => "AND");
- $sub->limit( column => "status", operator => "!=", value => "master", entry_aggregator => "AND");
- $sub->limit( column => "to_merge_into", value => $b->id );
- branchlist($sub);
+ branchlist($b->branches);
};
}
};
commit 3fee8b7d289c8051b168a7d1ab928b4790a9ecc0
Author: Alex Vandiver <alex at chmrr.net>
Date: Mon Jan 31 10:16:13 2011 -0500
Add a basic "What's cooking" page
diff --git a/lib/Smokingit/Dispatcher.pm b/lib/Smokingit/Dispatcher.pm
index 087900d..ccace64 100644
--- a/lib/Smokingit/Dispatcher.pm
+++ b/lib/Smokingit/Dispatcher.pm
@@ -58,9 +58,8 @@ under '/project/*' => [
show '/config';
},
- on 'new-configuration' => run {
- show '/new-configuration';
- },
+ on 'new-configuration' => run { show '/new-configuration'; },
+ on 'cooking.txt' => run { show '/cooking.txt'; },
];
# Commits and test commits
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index 567cfa8..f0205a4 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -164,4 +164,30 @@ sub branchlist {
}
}
+use Text::Wrap qw//;
+template '/cooking.txt' => sub {
+ redirect '/' unless get('project');
+ Jifty->web->response->content_type("text/plain");
+ my $out = "";
+ $out .= "What's cooking in ".get('project')->name . ".git\n";
+ $out .= ("-" x (length($out) - 1)) . "\n\n";
+
+ my $trunks = get('project')->trunks;
+ while (my $t = $trunks->next) {
+ $out .= $t->name."\n";
+
+ my $sub = $t->branches;
+ while ($b = $sub->next) {
+ $out .= " "x 4 . $b->name." - ".$b->owner . "\n";
+ $out .= " "x 6 . "[ " . $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);
+ $long .= "\n" if length $long;
+ $out .= "$long\n";
+ }
+ }
+ outs_raw( $out );
+};
+
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list