Show broken units in revision history
Summary: This is hacky, and I'm not sure I'm happy with it; Until T9365 is done, this will show up broken tests with an appropriate star in the Revision History. Test Plan: Created 1M messages in a couple of old diffs in a revision. The query took ~80us (On SSD drive). Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D16483
This commit is contained in:
@@ -292,9 +292,12 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
'/differential/comment/inline/edit/'.$revision->getID().'/');
|
||||
}
|
||||
|
||||
$broken_diffs = $this->loadHistoryDiffStatus($diffs);
|
||||
|
||||
$history = id(new DifferentialRevisionUpdateHistoryView())
|
||||
->setUser($viewer)
|
||||
->setDiffs($diffs)
|
||||
->setDiffUnitStatuses($broken_diffs)
|
||||
->setSelectedVersusDiffID($diff_vs)
|
||||
->setSelectedDiffID($target->getID())
|
||||
->setSelectedWhitespace($whitespace)
|
||||
@@ -776,6 +779,45 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
||||
return $actions_dict;
|
||||
}
|
||||
|
||||
private function loadHistoryDiffStatus(array $diffs) {
|
||||
assert_instances_of($diffs, 'DifferentialDiff');
|
||||
|
||||
$diff_phids = mpull($diffs, 'getPHID');
|
||||
$bad_unit_status = array(
|
||||
ArcanistUnitTestResult::RESULT_FAIL,
|
||||
ArcanistUnitTestResult::RESULT_BROKEN,
|
||||
);
|
||||
|
||||
$message = new HarbormasterBuildUnitMessage();
|
||||
$target = new HarbormasterBuildTarget();
|
||||
$build = new HarbormasterBuild();
|
||||
$buildable = new HarbormasterBuildable();
|
||||
|
||||
$broken_diffs = queryfx_all(
|
||||
$message->establishConnection('r'),
|
||||
'SELECT distinct a.buildablePHID
|
||||
FROM %T m
|
||||
JOIN %T t ON m.buildTargetPHID = t.phid
|
||||
JOIN %T b ON t.buildPHID = b.phid
|
||||
JOIN %T a ON b.buildablePHID = a.phid
|
||||
WHERE a.buildablePHID IN (%Ls)
|
||||
AND m.result in (%Ls)',
|
||||
$message->getTableName(),
|
||||
$target->getTableName(),
|
||||
$build->getTableName(),
|
||||
$buildable->getTableName(),
|
||||
$diff_phids,
|
||||
$bad_unit_status);
|
||||
|
||||
$unit_status = array();
|
||||
foreach ($broken_diffs as $broken) {
|
||||
$phid = $broken['buildablePHID'];
|
||||
$unit_status[$phid] = DifferentialUnitStatus::UNIT_FAIL;
|
||||
}
|
||||
|
||||
return $unit_status;
|
||||
}
|
||||
|
||||
private function loadChangesetsAndVsMap(
|
||||
DifferentialDiff $target,
|
||||
DifferentialDiff $diff_vs = null,
|
||||
|
||||
Reference in New Issue
Block a user