Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialDiff.php
Show First 20 Lines • Show All 354 Lines • ▼ Show 20 Lines | public function attachBuildable(HarbormasterBuildable $buildable = null) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getBuildable() { | public function getBuildable() { | ||||
return $this->assertAttached($this->buildable); | return $this->assertAttached($this->buildable); | ||||
} | } | ||||
public function getBuildTargetPHIDs() { | public function getBuildTargetPHIDs() { | ||||
$targets = $this->getBuildTargets(); | |||||
return mpull($targets, 'getPHID'); | |||||
} | |||||
public function getBuildTargets() { | |||||
$buildable = $this->getBuildable(); | $buildable = $this->getBuildable(); | ||||
if (!$buildable) { | if (!$buildable) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$target_phids = array(); | $targets = mpull($buildable->getBuilds(), 'getBuildTargets'); | ||||
foreach ($buildable->getBuilds() as $build) { | return array_mergev($targets); | ||||
foreach ($build->getBuildTargets() as $target) { | |||||
$target_phids[] = $target->getPHID(); | |||||
} | |||||
} | |||||
return $target_phids; | |||||
} | } | ||||
public function loadCoverageMap(PhabricatorUser $viewer) { | public function loadCoverageMap() { | ||||
// T10635: most of this information is already aggregated in BuildTarget. | |||||
$target_phids = $this->getBuildTargetPHIDs(); | $target_phids = $this->getBuildTargetPHIDs(); | ||||
if (!$target_phids) { | if (!$target_phids) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$unit = id(new HarbormasterBuildUnitMessage())->loadAllWhere( | $unit = id(new HarbormasterBuildUnitMessage())->loadAllWhere( | ||||
'buildTargetPHID IN (%Ls)', | 'buildTargetPHID IN (%Ls)', | ||||
$target_phids); | $target_phids); | ||||
$map = array(); | $map = array(); | ||||
foreach ($unit as $message) { | foreach ($unit as $message) { | ||||
$coverage = $message->getProperty('coverage', array()); | $coverage = $message->getProperty('coverage', array()); | ||||
foreach ($coverage as $path => $coverage_data) { | foreach ($coverage as $path => $coverage_data) { | ||||
Show All 14 Lines | final class DifferentialDiff | ||||
} | } | ||||
public function attachUnitMessages(array $unit_messages) { | public function attachUnitMessages(array $unit_messages) { | ||||
$this->unitMessages = $unit_messages; | $this->unitMessages = $unit_messages; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getUnitMessages() { | public function getUnitMessages() { | ||||
// T10635: practically no callsite of this method should want ALL messages. | |||||
return $this->assertAttached($this->unitMessages); | return $this->assertAttached($this->unitMessages); | ||||
} | } | ||||
public function getSummaryLintStatus() { | |||||
// For now, I'll hack this with a clever summation of | |||||
// $builds_lint_status and $diff->getLintStatus. | |||||
// Next, actually add a "meta" message about lint total status. | |||||
// That will also give us a path twords having a message of "10,000 units | |||||
// passed" (For T10635). | |||||
// With modern arc (post Harbormaster), any lint event (message) that | |||||
// contributes to $this->lintStatus will also exist in the Buildable. | |||||
// So only these cases have information in the diff that isn't reflected | |||||
// in the Buildable: LINT_NONE, LINT_OKAY, LINT_SKIP, LINT_AUTOSKIP. | |||||
// Of these, NONE, OKAY and AUTOSKIP are not interesting if there are no | |||||
// lint messages in the Buildable. | |||||
$buildable = $this->getBuildable(); | |||||
$buildable_lint = $buildable ? | |||||
$buildable->getDetail(HarbormasterBuildable::DETAIL_LINT_STATUS): | |||||
null; | |||||
$buildable_lint = HarbormasterLintStatus::getDifferentialLintStatus( | |||||
$buildable_lint); | |||||
$arc_status = $this->getLintStatus(); | |||||
if ($arc_status == DifferentialLintStatus::LINT_SKIP || !$buildable_lint) { | |||||
return $arc_status; | |||||
} | |||||
return $buildable_lint; | |||||
} | |||||
public function getSummaryUnitStatus() { | |||||
$buildable = $this->getBuildable(); | |||||
$buildable_unit = $buildable ? | |||||
$buildable->getDetail(HarbormasterBuildable::DETAIL_UNIT_STATUS) : | |||||
null; | |||||
$buildable_unit = HarbormasterUnitStatus::getDifferentialUnitStatus( | |||||
$buildable_unit); | |||||
$arc_status = $this->getUnitStatus(); | |||||
if ($arc_status == DifferentialUnitStatus::UNIT_SKIP || !$buildable_unit) { | |||||
return $arc_status; | |||||
} | |||||
return $buildable_unit; | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |