Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14012793
D13401.id32450.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D13401.id32450.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -265,8 +265,25 @@
$revision_detail_box->setInfoView($revision_warnings);
}
+ $detail_diffs = array_select_keys(
+ $diffs,
+ array($diff_vs, $target->getID()));
+ $detail_diffs = mpull($detail_diffs, null, 'getPHID');
+
+ $buildables = id(new HarbormasterBuildableQuery())
+ ->setViewer($user)
+ ->withBuildablePHIDs(array_keys($detail_diffs))
+ ->withManualBuildables(false)
+ ->needBuilds(true)
+ ->needTargets(true)
+ ->execute();
+ $buildables = mpull($buildables, null, 'getBuildablePHID');
+ foreach ($detail_diffs as $diff_phid => $detail_diff) {
+ $detail_diff->attachBuildable(idx($buildables, $diff_phid));
+ }
+
$diff_detail_box = $this->buildDiffDetailView(
- array_select_keys($diffs, array($diff_vs, $target->getID())),
+ $detail_diffs,
$revision,
$field_list);
diff --git a/src/applications/differential/customfield/DifferentialLintField.php b/src/applications/differential/customfield/DifferentialLintField.php
--- a/src/applications/differential/customfield/DifferentialLintField.php
+++ b/src/applications/differential/customfield/DifferentialLintField.php
@@ -54,7 +54,19 @@
$lint = array();
- // TODO: Look for Harbormaster messages here.
+ $buildable = $diff->getBuildable();
+ if ($buildable) {
+ $target_phids = array();
+ foreach ($buildable->getBuilds() as $build) {
+ foreach ($build->getBuildTargets() as $target) {
+ $target_phids[] = $target->getPHID();
+ }
+ }
+
+ $lint = id(new HarbormasterBuildLintMessage())->loadAllWhere(
+ 'buildTargetPHID IN (%Ls) LIMIT 25',
+ $target_phids);
+ }
if (!$lint) {
// No Harbormaster messages, so look for legacy messages and make them
diff --git a/src/applications/differential/customfield/DifferentialUnitField.php b/src/applications/differential/customfield/DifferentialUnitField.php
--- a/src/applications/differential/customfield/DifferentialUnitField.php
+++ b/src/applications/differential/customfield/DifferentialUnitField.php
@@ -52,7 +52,19 @@
$unit = array();
- // TODO: Look for Harbormaster results here.
+ $buildable = $diff->getBuildable();
+ if ($buildable) {
+ $target_phids = array();
+ foreach ($buildable->getBuilds() as $build) {
+ foreach ($build->getBuildTargets() as $target) {
+ $target_phids[] = $target->getPHID();
+ }
+ }
+
+ $unit = id(new HarbormasterBuildUnitMessage())->loadAllWhere(
+ 'buildTargetPHID IN (%Ls) LIMIT 25',
+ $target_phids);
+ }
if (!$unit) {
$legacy_unit = $diff->getProperty('arc:unit');
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -39,6 +39,7 @@
private $changesets = self::ATTACHABLE;
private $revision = self::ATTACHABLE;
private $properties = array();
+ private $buildable = self::ATTACHABLE;
protected function getConfiguration() {
return array(
@@ -323,6 +324,15 @@
return $this->assertAttachedKey($this->properties, $key);
}
+ public function attachBuildable(HarbormasterBuildable $buildable = null) {
+ $this->buildable = $buildable;
+ return $this;
+ }
+
+ public function getBuildable() {
+ return $this->assertAttached($this->buildable);
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/harbormaster/query/HarbormasterBuildableQuery.php b/src/applications/harbormaster/query/HarbormasterBuildableQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildableQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildableQuery.php
@@ -13,6 +13,7 @@
private $needContainerHandles;
private $needBuildableHandles;
private $needBuilds;
+ private $needTargets;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -59,19 +60,17 @@
return $this;
}
- protected function loadPage() {
- $table = new HarbormasterBuildable();
- $conn_r = $table->establishConnection('r');
+ public function needTargets($need) {
+ $this->needTargets = $need;
+ return $this;
+ }
- $data = queryfx_all(
- $conn_r,
- 'SELECT * FROM %T %Q %Q %Q',
- $table->getTableName(),
- $this->buildWhereClause($conn_r),
- $this->buildOrderClause($conn_r),
- $this->buildLimitClause($conn_r));
+ public function newResultObject() {
+ return new HarbormasterBuildable();
+ }
- return $table->loadAllFromArray($data);
+ protected function loadPage() {
+ return $this->loadStandardPage($this->newResultObject());
}
protected function willFilterPage(array $page) {
@@ -157,11 +156,12 @@
}
}
- if ($this->needBuilds) {
+ if ($this->needBuilds || $this->needTargets) {
$builds = id(new HarbormasterBuildQuery())
->setViewer($this->getViewer())
->setParentQuery($this)
->withBuildablePHIDs(mpull($page, 'getPHID'))
+ ->needBuildTargets($this->needTargets)
->execute();
$builds = mgroup($builds, 'getBuildablePHID');
foreach ($page as $key => $buildable) {
@@ -172,47 +172,45 @@
return $page;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
- $where = array();
+ protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
+ $where = parent::buildWhereClauseParts($conn);
if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->buildablePHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'buildablePHID IN (%Ls)',
$this->buildablePHIDs);
}
if ($this->containerPHIDs !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'containerPHID in (%Ls)',
$this->containerPHIDs);
}
if ($this->manualBuildables !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isManualBuildable = %d',
(int)$this->manualBuildables);
}
- $where[] = $this->buildPagingClause($conn_r);
-
- return $this->formatWhereClause($where);
+ return $where;
}
public function getQueryApplicationClass() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 2, 6:57 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6757208
Default Alt Text
D13401.id32450.diff (6 KB)
Attached To
Mode
D13401: Make Differential load lint/unit data from Harbormaster
Attached
Detach File
Event Timeline
Log In to Comment