@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.

Display revision number in history

Test Plan:
Displayed repository.
Displayed repository history.
Wondered that we actually have bunch of commits without a revision.
Displayed blame.
Didn't display merge commit.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

vrana d7b8bc89 969dcc5b

+52 -13
+12
src/applications/differential/storage/DifferentialRevision.php
··· 69 69 return $this; 70 70 } 71 71 72 + public function loadIDsByCommitPHIDs($phids) { 73 + if (!$phids) { 74 + return array(); 75 + } 76 + $revision_ids = queryfx_all( 77 + $this->establishConnection('r'), 78 + 'SELECT * FROM %T WHERE commitPHID IN (%Ls)', 79 + self::TABLE_COMMIT, 80 + $phids); 81 + return ipull($revision_ids, 'revisionID', 'commitPHID'); 82 + } 83 + 72 84 public function loadCommitPHIDs() { 73 85 if (!$this->getID()) { 74 86 return ($this->commits = array());
+6 -13
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 388 388 $commits = mpull($commits, null, 'getCommitIdentifier'); 389 389 } 390 390 391 - $revision_ids = array(); 391 + $revision_ids = id(new DifferentialRevision()) 392 + ->loadIDsByCommitPHIDs(mpull($commits, 'getPHID')); 392 393 $revisions = array(); 393 - if ($commits) { 394 - $revision_ids = queryfx_all( 395 - id(new DifferentialRevision())->establishConnection('r'), 396 - 'SELECT * FROM %T WHERE commitPHID IN (%Ls)', 397 - DifferentialRevision::TABLE_COMMIT, 398 - mpull($commits, 'getPHID')); 399 - if ($revision_ids) { 400 - $revision_ids = ipull($revision_ids, 'revisionID', 'commitPHID'); 401 - $revisions = id(new DifferentialRevision())->loadAllWhere( 402 - 'id IN (%Ld)', 403 - $revision_ids); 404 - } 394 + if ($revision_ids) { 395 + $revisions = id(new DifferentialRevision())->loadAllWhere( 396 + 'id IN (%Ld)', 397 + $revision_ids); 405 398 } 406 399 407 400 $request = $this->getRequest();
+1
src/applications/diffusion/controller/DiffusionCommitController.php
··· 682 682 $history_table = new DiffusionHistoryTableView(); 683 683 $history_table->setDiffusionRequest($drequest); 684 684 $history_table->setHistory($merges); 685 + $history_table->loadRevisions(); 685 686 686 687 $phids = $history_table->getRequiredHandlePHIDs(); 687 688 $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
+1
src/applications/diffusion/controller/DiffusionHistoryController.php
··· 81 81 $history_table = new DiffusionHistoryTableView(); 82 82 $history_table->setDiffusionRequest($drequest); 83 83 $history_table->setHistory($history); 84 + $history_table->loadRevisions(); 84 85 85 86 $phids = $history_table->getRequiredHandlePHIDs(); 86 87 $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
+1
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 70 70 $history_table->setDiffusionRequest($drequest); 71 71 $history_table->setHandles($handles); 72 72 $history_table->setHistory($history); 73 + $history_table->loadRevisions(); 73 74 $history_table->setParents($history_query->getParents()); 74 75 $history_table->setIsHead(true); 75 76
+18
src/applications/diffusion/view/DiffusionHistoryTableView.php
··· 19 19 final class DiffusionHistoryTableView extends DiffusionView { 20 20 21 21 private $history; 22 + private $revisions = array(); 22 23 private $handles = array(); 23 24 private $isHead; 24 25 private $parents; ··· 26 27 public function setHistory(array $history) { 27 28 assert_instances_of($history, 'DiffusionPathChange'); 28 29 $this->history = $history; 30 + return $this; 31 + } 32 + 33 + public function loadRevisions() { 34 + $commit_phids = array(); 35 + foreach ($this->history as $item) { 36 + if ($item->getCommit()) { 37 + $commit_phids[] = $item->getCommit()->getPHID(); 38 + } 39 + } 40 + $this->revisions = id(new DifferentialRevision()) 41 + ->loadIDsByCommitPHIDs($commit_phids); 29 42 return $this; 30 43 } 31 44 ··· 134 147 self::linkCommit( 135 148 $drequest->getRepository(), 136 149 $history->getCommitIdentifier()), 150 + ($commit ? 151 + self::linkRevision(idx($this->revisions, $commit->getPHID())) : 152 + null), 137 153 $change, 138 154 $date, 139 155 $time, ··· 150 166 'Browse', 151 167 '', 152 168 'Commit', 169 + 'Revision', 153 170 'Change', 154 171 'Date', 155 172 'Time', ··· 160 177 array( 161 178 '', 162 179 'threads', 180 + 'n', 163 181 'n', 164 182 '', 165 183 '',
+13
src/applications/diffusion/view/DiffusionView.php
··· 134 134 $commit_name); 135 135 } 136 136 137 + final public static function linkRevision($id) { 138 + if (!$id) { 139 + return null; 140 + } 141 + 142 + return phutil_render_tag( 143 + 'a', 144 + array( 145 + 'href' => "/D{$id}", 146 + ), 147 + "D{$id}"); 148 + } 149 + 137 150 }