@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make Differential load lint/unit data from Harbormaster

Summary: Fixes T8095. Still needs UI/UX work (see T8096) but this has all the core features now.

Test Plan: Saw Harbormaster lint/unit data as though it was Differential lint-unit data.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8095

Differential Revision: https://secure.phabricator.com/D13401

+75 -36
+1 -11
resources/celerity/map.php
··· 10 10 'core.pkg.css' => 'eb51e6dc', 11 11 'core.pkg.js' => '711e63c0', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 - 'differential.pkg.css' => '02273347', 13 + 'differential.pkg.css' => '1ca3c116', 14 14 'differential.pkg.js' => 'ebef29b1', 15 15 'diffusion.pkg.css' => '591664fa', 16 16 'diffusion.pkg.js' => '0115b37c', ··· 61 61 'rsrc/css/application/differential/changeset-view.css' => 'e19cfd6e', 62 62 'rsrc/css/application/differential/core.css' => '7ac3cabc', 63 63 'rsrc/css/application/differential/phui-inline-comment.css' => 'aa16f165', 64 - 'rsrc/css/application/differential/results-table.css' => '181aa9d9', 65 64 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', 66 65 'rsrc/css/application/differential/revision-history.css' => '0e8eb855', 67 66 'rsrc/css/application/differential/revision-list.css' => 'f3c47d33', ··· 358 357 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '037b59eb', 359 358 'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492', 360 359 'rsrc/js/application/differential/behavior-populate.js' => '8694b1df', 361 - 'rsrc/js/application/differential/behavior-show-field-details.js' => 'bba9eedf', 362 360 'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb', 363 361 'rsrc/js/application/differential/behavior-user-select.js' => 'a8d8459d', 364 362 'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => 'b42eddc7', ··· 513 511 'differential-changeset-view-css' => 'e19cfd6e', 514 512 'differential-core-view-css' => '7ac3cabc', 515 513 'differential-inline-comment-editor' => 'd4c87bf4', 516 - 'differential-results-table-css' => '181aa9d9', 517 514 'differential-revision-add-comment-css' => 'c47f8c40', 518 515 'differential-revision-comment-css' => '14b8565a', 519 516 'differential-revision-history-css' => '0e8eb855', ··· 567 564 'javelin-behavior-differential-feedback-preview' => 'b064af76', 568 565 'javelin-behavior-differential-keyboard-navigation' => '2c426492', 569 566 'javelin-behavior-differential-populate' => '8694b1df', 570 - 'javelin-behavior-differential-show-field-details' => 'bba9eedf', 571 567 'javelin-behavior-differential-toggle-files' => 'ca3f91eb', 572 568 'javelin-behavior-differential-user-select' => 'a8d8459d', 573 569 'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04', ··· 1705 1701 'javelin-workflow', 1706 1702 'phabricator-draggable-list', 1707 1703 ), 1708 - 'bba9eedf' => array( 1709 - 'javelin-behavior', 1710 - 'javelin-stratcom', 1711 - 'javelin-dom', 1712 - ), 1713 1704 'bd4c8dca' => array( 1714 1705 'javelin-install', 1715 1706 'javelin-util', ··· 2192 2183 'differential.pkg.css' => array( 2193 2184 'differential-core-view-css', 2194 2185 'differential-changeset-view-css', 2195 - 'differential-results-table-css', 2196 2186 'differential-revision-history-css', 2197 2187 'differential-revision-list-css', 2198 2188 'differential-table-of-contents-css',
+18 -1
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 265 265 $revision_detail_box->setInfoView($revision_warnings); 266 266 } 267 267 268 + $detail_diffs = array_select_keys( 269 + $diffs, 270 + array($diff_vs, $target->getID())); 271 + $detail_diffs = mpull($detail_diffs, null, 'getPHID'); 272 + 273 + $buildables = id(new HarbormasterBuildableQuery()) 274 + ->setViewer($user) 275 + ->withBuildablePHIDs(array_keys($detail_diffs)) 276 + ->withManualBuildables(false) 277 + ->needBuilds(true) 278 + ->needTargets(true) 279 + ->execute(); 280 + $buildables = mpull($buildables, null, 'getBuildablePHID'); 281 + foreach ($detail_diffs as $diff_phid => $detail_diff) { 282 + $detail_diff->attachBuildable(idx($buildables, $diff_phid)); 283 + } 284 + 268 285 $diff_detail_box = $this->buildDiffDetailView( 269 - array_select_keys($diffs, array($diff_vs, $target->getID())), 286 + $detail_diffs, 270 287 $revision, 271 288 $field_list); 272 289
+13 -1
src/applications/differential/customfield/DifferentialLintField.php
··· 54 54 55 55 $lint = array(); 56 56 57 - // TODO: Look for Harbormaster messages here. 57 + $buildable = $diff->getBuildable(); 58 + if ($buildable) { 59 + $target_phids = array(); 60 + foreach ($buildable->getBuilds() as $build) { 61 + foreach ($build->getBuildTargets() as $target) { 62 + $target_phids[] = $target->getPHID(); 63 + } 64 + } 65 + 66 + $lint = id(new HarbormasterBuildLintMessage())->loadAllWhere( 67 + 'buildTargetPHID IN (%Ls) LIMIT 25', 68 + $target_phids); 69 + } 58 70 59 71 if (!$lint) { 60 72 // No Harbormaster messages, so look for legacy messages and make them
+13 -1
src/applications/differential/customfield/DifferentialUnitField.php
··· 52 52 53 53 $unit = array(); 54 54 55 - // TODO: Look for Harbormaster results here. 55 + $buildable = $diff->getBuildable(); 56 + if ($buildable) { 57 + $target_phids = array(); 58 + foreach ($buildable->getBuilds() as $build) { 59 + foreach ($build->getBuildTargets() as $target) { 60 + $target_phids[] = $target->getPHID(); 61 + } 62 + } 63 + 64 + $unit = id(new HarbormasterBuildUnitMessage())->loadAllWhere( 65 + 'buildTargetPHID IN (%Ls) LIMIT 25', 66 + $target_phids); 67 + } 56 68 57 69 if (!$unit) { 58 70 $legacy_unit = $diff->getProperty('arc:unit');
+10
src/applications/differential/storage/DifferentialDiff.php
··· 39 39 private $changesets = self::ATTACHABLE; 40 40 private $revision = self::ATTACHABLE; 41 41 private $properties = array(); 42 + private $buildable = self::ATTACHABLE; 42 43 43 44 protected function getConfiguration() { 44 45 return array( ··· 321 322 322 323 public function getProperty($key) { 323 324 return $this->assertAttachedKey($this->properties, $key); 325 + } 326 + 327 + public function attachBuildable(HarbormasterBuildable $buildable = null) { 328 + $this->buildable = $buildable; 329 + return $this; 330 + } 331 + 332 + public function getBuildable() { 333 + return $this->assertAttached($this->buildable); 324 334 } 325 335 326 336
+20 -22
src/applications/harbormaster/query/HarbormasterBuildableQuery.php
··· 13 13 private $needContainerHandles; 14 14 private $needBuildableHandles; 15 15 private $needBuilds; 16 + private $needTargets; 16 17 17 18 public function withIDs(array $ids) { 18 19 $this->ids = $ids; ··· 59 60 return $this; 60 61 } 61 62 62 - protected function loadPage() { 63 - $table = new HarbormasterBuildable(); 64 - $conn_r = $table->establishConnection('r'); 63 + public function needTargets($need) { 64 + $this->needTargets = $need; 65 + return $this; 66 + } 65 67 66 - $data = queryfx_all( 67 - $conn_r, 68 - 'SELECT * FROM %T %Q %Q %Q', 69 - $table->getTableName(), 70 - $this->buildWhereClause($conn_r), 71 - $this->buildOrderClause($conn_r), 72 - $this->buildLimitClause($conn_r)); 68 + public function newResultObject() { 69 + return new HarbormasterBuildable(); 70 + } 73 71 74 - return $table->loadAllFromArray($data); 72 + protected function loadPage() { 73 + return $this->loadStandardPage($this->newResultObject()); 75 74 } 76 75 77 76 protected function willFilterPage(array $page) { ··· 157 156 } 158 157 } 159 158 160 - if ($this->needBuilds) { 159 + if ($this->needBuilds || $this->needTargets) { 161 160 $builds = id(new HarbormasterBuildQuery()) 162 161 ->setViewer($this->getViewer()) 163 162 ->setParentQuery($this) 164 163 ->withBuildablePHIDs(mpull($page, 'getPHID')) 164 + ->needBuildTargets($this->needTargets) 165 165 ->execute(); 166 166 $builds = mgroup($builds, 'getBuildablePHID'); 167 167 foreach ($page as $key => $buildable) { ··· 172 172 return $page; 173 173 } 174 174 175 - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 176 - $where = array(); 175 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 176 + $where = parent::buildWhereClauseParts($conn); 177 177 178 178 if ($this->ids !== null) { 179 179 $where[] = qsprintf( 180 - $conn_r, 180 + $conn, 181 181 'id IN (%Ld)', 182 182 $this->ids); 183 183 } 184 184 185 185 if ($this->phids !== null) { 186 186 $where[] = qsprintf( 187 - $conn_r, 187 + $conn, 188 188 'phid IN (%Ls)', 189 189 $this->phids); 190 190 } 191 191 192 192 if ($this->buildablePHIDs !== null) { 193 193 $where[] = qsprintf( 194 - $conn_r, 194 + $conn, 195 195 'buildablePHID IN (%Ls)', 196 196 $this->buildablePHIDs); 197 197 } 198 198 199 199 if ($this->containerPHIDs !== null) { 200 200 $where[] = qsprintf( 201 - $conn_r, 201 + $conn, 202 202 'containerPHID in (%Ls)', 203 203 $this->containerPHIDs); 204 204 } 205 205 206 206 if ($this->manualBuildables !== null) { 207 207 $where[] = qsprintf( 208 - $conn_r, 208 + $conn, 209 209 'isManualBuildable = %d', 210 210 (int)$this->manualBuildables); 211 211 } 212 212 213 - $where[] = $this->buildPagingClause($conn_r); 214 - 215 - return $this->formatWhereClause($where); 213 + return $where; 216 214 } 217 215 218 216 public function getQueryApplicationClass() {