forked from lix-project/hydra
Fix getResponsibleAuthors
This commit is contained in:
parent
0d28e9372b
commit
7b5b434014
|
@ -14,7 +14,7 @@ our @EXPORT = qw(
|
||||||
error notFound gone accessDenied
|
error notFound gone accessDenied
|
||||||
forceLogin requireUser requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner
|
forceLogin requireUser requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner
|
||||||
trim
|
trim
|
||||||
getLatestFinishedEval
|
getLatestFinishedEval getFirstEval
|
||||||
paramToList
|
paramToList
|
||||||
backToReferer
|
backToReferer
|
||||||
$pathCompRE $relPathRE $relNameRE $projectNameRE $jobsetNameRE $jobNameRE $systemRE $userNameRE $inputNameRE
|
$pathCompRE $relPathRE $relNameRE $projectNameRE $jobsetNameRE $jobNameRE $systemRE $userNameRE $inputNameRE
|
||||||
|
@ -188,6 +188,14 @@ sub getLatestFinishedEval {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub getFirstEval {
|
||||||
|
my ($build) = @_;
|
||||||
|
return $build->jobsetevals->search(
|
||||||
|
{ hasnewbuilds => 1},
|
||||||
|
{ rows => 1, order_by => ["id"] })->single;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Catalyst request parameters can be an array or a scalar or
|
# Catalyst request parameters can be an array or a scalar or
|
||||||
# undefined, making them annoying to handle. So this utility function
|
# undefined, making them annoying to handle. So this utility function
|
||||||
# always returns a request parameter as a list.
|
# always returns a request parameter as a list.
|
||||||
|
@ -247,15 +255,18 @@ sub getResponsibleAuthors {
|
||||||
my ($build, $plugins) = @_;
|
my ($build, $plugins) = @_;
|
||||||
|
|
||||||
my $prevBuild = getPreviousBuild($build);
|
my $prevBuild = getPreviousBuild($build);
|
||||||
|
return ({}, 0, []) unless $prevBuild;
|
||||||
|
|
||||||
my $nrCommits = 0;
|
my $nrCommits = 0;
|
||||||
my %authors;
|
my %authors;
|
||||||
my @emailable_authors;
|
my @emailable_authors;
|
||||||
|
|
||||||
if ($prevBuild) {
|
my $prevEval = getFirstEval($prevBuild);
|
||||||
foreach my $curInput ($build->buildinputs_builds) {
|
my $eval = getFirstEval($build);
|
||||||
|
|
||||||
|
foreach my $curInput ($eval->jobsetevalinputs) {
|
||||||
next unless ($curInput->type eq "git" || $curInput->type eq "hg");
|
next unless ($curInput->type eq "git" || $curInput->type eq "hg");
|
||||||
my $prevInput = $prevBuild->buildinputs_builds->find({ name => $curInput->name });
|
my $prevInput = $prevEval->jobsetevalinputs->find({ name => $curInput->name });
|
||||||
next unless defined $prevInput;
|
next unless defined $prevInput;
|
||||||
|
|
||||||
next if $curInput->type ne $prevInput->type;
|
next if $curInput->type ne $prevInput->type;
|
||||||
|
@ -270,11 +281,11 @@ sub getResponsibleAuthors {
|
||||||
foreach my $commit (@commits) {
|
foreach my $commit (@commits) {
|
||||||
#print STDERR "$commit->{revision} by $commit->{author}\n";
|
#print STDERR "$commit->{revision} by $commit->{author}\n";
|
||||||
$authors{$commit->{author}} = $commit->{email};
|
$authors{$commit->{author}} = $commit->{email};
|
||||||
push @emailable_authors, $commit->{email} if $curInput->emailresponsible;
|
my $inputSpec = $build->jobset->jobsetinputs->find({ name => $curInput->name });
|
||||||
|
push @emailable_authors, $commit->{email} if $inputSpec && $inputSpec->emailresponsible;
|
||||||
$nrCommits++;
|
$nrCommits++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return (\%authors, $nrCommits, \@emailable_authors);
|
return (\%authors, $nrCommits, \@emailable_authors);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue