mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 15:30:58 +01:00
Distinguish between "no coverage information" and "no test coverage" better
Summary: Fixes T10169. Diffs with no build targets were incorrectly showing as though they had no test coverage, when we actually want to show them having no coverage information available. Test Plan: Viewed an older revision, saw a column of "Not Executable" before change, now see no column. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10169 Differential Revision: https://secure.phabricator.com/D15044
This commit is contained in:
parent
495e1384dd
commit
45a4a68628
1 changed files with 13 additions and 2 deletions
|
@ -400,16 +400,23 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
|||
private function loadCoverage(DifferentialChangeset $changeset) {
|
||||
$target_phids = $changeset->getDiff()->getBuildTargetPHIDs();
|
||||
if (!$target_phids) {
|
||||
return array();
|
||||
return null;
|
||||
}
|
||||
|
||||
$unit = id(new HarbormasterBuildUnitMessage())->loadAllWhere(
|
||||
'buildTargetPHID IN (%Ls)',
|
||||
$target_phids);
|
||||
|
||||
if (!$unit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$coverage = array();
|
||||
foreach ($unit as $message) {
|
||||
$test_coverage = $message->getProperty('coverage', array());
|
||||
$test_coverage = $message->getProperty('coverage');
|
||||
if ($test_coverage === null) {
|
||||
continue;
|
||||
}
|
||||
$coverage_data = idx($test_coverage, $changeset->getFileName());
|
||||
if (!strlen($coverage_data)) {
|
||||
continue;
|
||||
|
@ -417,6 +424,10 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
|||
$coverage[] = $coverage_data;
|
||||
}
|
||||
|
||||
if (!$coverage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ArcanistUnitTestResult::mergeCoverage($coverage);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue