Differential D18714 Diff 44929 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
| Show First 20 Lines • Show All 1,564 Lines • ▼ Show 20 Lines | if ($object->isDraft() && $auto_undraft) { | ||||
| } | } | ||||
| } | } | ||||
| return $xactions; | return $xactions; | ||||
| } | } | ||||
| private function hasActiveBuilds($object) { | private function hasActiveBuilds($object) { | ||||
| $viewer = $this->requireActor(); | $viewer = $this->requireActor(); | ||||
| $diff = $object->getActiveDiff(); | |||||
| $buildables = id(new HarbormasterBuildableQuery()) | $builds = $object->loadActiveBuilds($viewer); | ||||
| ->setViewer($viewer) | |||||
| ->withContainerPHIDs(array($object->getPHID())) | |||||
| ->withBuildablePHIDs(array($diff->getPHID())) | |||||
| ->withManualBuildables(false) | |||||
| ->execute(); | |||||
| if (!$buildables) { | |||||
| return false; | |||||
| } | |||||
| $builds = id(new HarbormasterBuildQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withBuildablePHIDs(mpull($buildables, 'getPHID')) | |||||
| ->withBuildStatuses( | |||||
| array( | |||||
| HarbormasterBuildStatus::STATUS_INACTIVE, | |||||
| HarbormasterBuildStatus::STATUS_PENDING, | |||||
| HarbormasterBuildStatus::STATUS_BUILDING, | |||||
| HarbormasterBuildStatus::STATUS_FAILED, | |||||
| HarbormasterBuildStatus::STATUS_ABORTED, | |||||
| HarbormasterBuildStatus::STATUS_ERROR, | |||||
| HarbormasterBuildStatus::STATUS_PAUSED, | |||||
| HarbormasterBuildStatus::STATUS_DEADLOCKED, | |||||
| )) | |||||
| ->needBuildTargets(true) | |||||
| ->execute(); | |||||
| if (!$builds) { | if (!$builds) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| $active = array(); | |||||
| foreach ($builds as $key => $build) { | |||||
| foreach ($build->getBuildTargets() as $target) { | |||||
| if ($target->isAutotarget()) { | |||||
| // Ignore autotargets when looking for active of failed builds. If | |||||
| // local tests fail and you continue anyway, you don't need to | |||||
| // double-confirm them. | |||||
| continue; | |||||
| } | |||||
| // This build has at least one real target that's doing something. | |||||
| $active[$key] = $build; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (!$active) { | |||||
| return false; | |||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||