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

Remove "DiffusionHistoryTableView" and "DiffusionHistoryView"

Summary:
Ref T13552.

Currently, the "Browse" page shows a snippet of unmerged changes if you're looking at a non-default branch. Remove this for consistency with the simplified main "Browse" page. This is reachable via "Compare".

Update the "Compare" page to use the new "CommitGraphView".

Test Plan:
- Looked at the "Browse" page of "stable".
- Looked at the "Compare" page for "stable vs master".

Maniphest Tasks: T13552

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

+3 -405
-4
src/__phutil_library_map__.php
··· 863 863 'DiffusionGitWireProtocolRefList' => 'applications/diffusion/protocol/DiffusionGitWireProtocolRefList.php', 864 864 'DiffusionHistoryController' => 'applications/diffusion/controller/DiffusionHistoryController.php', 865 865 'DiffusionHistoryQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php', 866 - 'DiffusionHistoryTableView' => 'applications/diffusion/view/DiffusionHistoryTableView.php', 867 - 'DiffusionHistoryView' => 'applications/diffusion/view/DiffusionHistoryView.php', 868 866 'DiffusionHovercardEngineExtension' => 'applications/diffusion/engineextension/DiffusionHovercardEngineExtension.php', 869 867 'DiffusionIdentityAssigneeDatasource' => 'applications/diffusion/typeahead/DiffusionIdentityAssigneeDatasource.php', 870 868 'DiffusionIdentityAssigneeEditField' => 'applications/diffusion/editfield/DiffusionIdentityAssigneeEditField.php', ··· 6955 6953 'DiffusionGitWireProtocolRefList' => 'Phobject', 6956 6954 'DiffusionHistoryController' => 'DiffusionController', 6957 6955 'DiffusionHistoryQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 6958 - 'DiffusionHistoryTableView' => 'DiffusionHistoryView', 6959 - 'DiffusionHistoryView' => 'DiffusionView', 6960 6956 'DiffusionHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 6961 6957 'DiffusionIdentityAssigneeDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 6962 6958 'DiffusionIdentityAssigneeEditField' => 'PhabricatorTokenizerEditField',
-63
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 292 292 293 293 $empty_result = null; 294 294 $browse_panel = null; 295 - $branch_panel = null; 296 295 if (!$results->isValidResults()) { 297 296 $empty_result = new DiffusionEmptyResultView(); 298 297 $empty_result->setDiffusionRequest($drequest); ··· 328 327 ->setTable($browse_table) 329 328 ->addClass('diffusion-mobile-view') 330 329 ->setPager($pager); 331 - 332 - $path = $drequest->getPath(); 333 - $is_branch = (!strlen($path) && $repository->supportsBranchComparison()); 334 - if ($is_branch) { 335 - $branch_panel = $this->buildBranchTable(); 336 - } 337 330 } 338 331 339 332 $open_revisions = $this->buildOpenRevisions(); ··· 359 352 ->setFooter( 360 353 array( 361 354 $bar, 362 - $branch_panel, 363 355 $empty_result, 364 356 $browse_panel, 365 357 $open_revisions, ··· 1072 1064 } 1073 1065 1074 1066 return $file; 1075 - } 1076 - 1077 - private function buildBranchTable() { 1078 - $viewer = $this->getViewer(); 1079 - $drequest = $this->getDiffusionRequest(); 1080 - $repository = $drequest->getRepository(); 1081 - 1082 - $branch = $drequest->getBranch(); 1083 - $default_branch = $repository->getDefaultBranch(); 1084 - 1085 - if ($branch === $default_branch) { 1086 - return null; 1087 - } 1088 - 1089 - $pager = id(new PHUIPagerView()) 1090 - ->setPageSize(10); 1091 - 1092 - try { 1093 - $results = $this->callConduitWithDiffusionRequest( 1094 - 'diffusion.historyquery', 1095 - array( 1096 - 'commit' => $branch, 1097 - 'against' => $default_branch, 1098 - 'path' => $drequest->getPath(), 1099 - 'offset' => $pager->getOffset(), 1100 - 'limit' => $pager->getPageSize() + 1, 1101 - )); 1102 - } catch (Exception $ex) { 1103 - return null; 1104 - } 1105 - 1106 - $history = DiffusionPathChange::newFromConduit($results['pathChanges']); 1107 - $history = $pager->sliceResults($history); 1108 - 1109 - if (!$history) { 1110 - return null; 1111 - } 1112 - 1113 - $history_table = id(new DiffusionHistoryTableView()) 1114 - ->setViewer($viewer) 1115 - ->setDiffusionRequest($drequest) 1116 - ->setHistory($history) 1117 - ->setParents($results['parents']) 1118 - ->setFilterParents(true) 1119 - ->setIsHead(true) 1120 - ->setIsTail(!$pager->getHasMorePages()); 1121 - 1122 - $header = id(new PHUIHeaderView()) 1123 - ->setHeader(pht('%s vs %s', $branch, $default_branch)); 1124 - 1125 - return id(new PHUIObjectBoxView()) 1126 - ->setHeader($header) 1127 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 1128 - ->addClass('diffusion-mobile-view') 1129 - ->setTable($history_table); 1130 1067 } 1131 1068 1132 1069 }
+3 -13
src/applications/diffusion/controller/DiffusionCompareController.php
··· 285 285 $request = $this->getRequest(); 286 286 $viewer = $this->getViewer(); 287 287 $drequest = $this->getDiffusionRequest(); 288 - $repository = $drequest->getRepository(); 289 288 290 289 if (!$history) { 291 290 return $this->renderStatusMessage( ··· 296 295 phutil_tag('strong', array(), $against_ref))); 297 296 } 298 297 299 - $history_table = id(new DiffusionHistoryTableView()) 300 - ->setUser($viewer) 298 + $history_view = id(new DiffusionCommitGraphView()) 299 + ->setViewer($viewer) 301 300 ->setDiffusionRequest($drequest) 302 301 ->setHistory($history) 303 302 ->setParents($results['parents']) ··· 305 304 ->setIsHead(!$pager->getOffset()) 306 305 ->setIsTail(!$pager->getHasMorePages()); 307 306 308 - $header = id(new PHUIHeaderView()) 309 - ->setHeader(pht('Commits')); 310 - 311 - return id(new PHUIObjectBoxView()) 312 - ->setHeader($header) 313 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 314 - ->setTable($history_table) 315 - ->addClass('diffusion-mobile-view') 316 - ->setPager($pager); 317 - 307 + return $history_view; 318 308 } 319 309 }
-208
src/applications/diffusion/view/DiffusionHistoryTableView.php
··· 1 - <?php 2 - 3 - final class DiffusionHistoryTableView extends DiffusionHistoryView { 4 - 5 - public function render() { 6 - $drequest = $this->getDiffusionRequest(); 7 - 8 - $viewer = $this->getUser(); 9 - 10 - $buildables = $this->loadBuildables( 11 - mpull($this->getHistory(), 'getCommit')); 12 - $has_any_build = false; 13 - 14 - $show_revisions = PhabricatorApplication::isClassInstalledForViewer( 15 - 'PhabricatorDifferentialApplication', 16 - $viewer); 17 - 18 - $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); 19 - 20 - $graph = null; 21 - if ($this->getParents()) { 22 - $parents = $this->getParents(); 23 - 24 - // If we're filtering parents, remove relationships which point to 25 - // commits that are not part of the visible graph. Otherwise, we get 26 - // a big tree of nonsense when viewing release branches like "stable" 27 - // versus "master". 28 - if ($this->getFilterParents()) { 29 - foreach ($parents as $key => $nodes) { 30 - foreach ($nodes as $nkey => $node) { 31 - if (empty($parents[$node])) { 32 - unset($parents[$key][$nkey]); 33 - } 34 - } 35 - } 36 - } 37 - 38 - $graph = id(new PHUIDiffGraphView()) 39 - ->setIsHead($this->getIsHead()) 40 - ->setIsTail($this->getIsTail()) 41 - ->renderGraph($parents); 42 - } 43 - 44 - $show_builds = PhabricatorApplication::isClassInstalledForViewer( 45 - 'PhabricatorHarbormasterApplication', 46 - $this->getUser()); 47 - 48 - $rows = array(); 49 - $ii = 0; 50 - foreach ($this->getHistory() as $history) { 51 - $epoch = $history->getEpoch(); 52 - 53 - if ($epoch) { 54 - $committed = $viewer->formatShortDateTime($epoch); 55 - } else { 56 - $committed = null; 57 - } 58 - 59 - $data = $history->getCommitData(); 60 - $author_phid = $committer = $committer_phid = null; 61 - if ($data) { 62 - $author_phid = $data->getCommitDetail('authorPHID'); 63 - $committer_phid = $data->getCommitDetail('committerPHID'); 64 - $committer = $data->getCommitDetail('committer'); 65 - } 66 - 67 - if ($author_phid && isset($handles[$author_phid])) { 68 - $author = $handles[$author_phid]->renderLink(); 69 - } else { 70 - $author = self::renderName($history->getAuthorName()); 71 - } 72 - 73 - $different_committer = false; 74 - if ($committer_phid) { 75 - $different_committer = ($committer_phid != $author_phid); 76 - } else if ($committer != '') { 77 - $different_committer = ($committer != $history->getAuthorName()); 78 - } 79 - if ($different_committer) { 80 - if ($committer_phid && isset($handles[$committer_phid])) { 81 - $committer = $handles[$committer_phid]->renderLink(); 82 - } else { 83 - $committer = self::renderName($committer); 84 - } 85 - $author = hsprintf('%s/%s', $author, $committer); 86 - } 87 - 88 - // We can show details once the message and change have been imported. 89 - $partial_import = PhabricatorRepositoryCommit::IMPORTED_MESSAGE | 90 - PhabricatorRepositoryCommit::IMPORTED_CHANGE; 91 - 92 - $commit = $history->getCommit(); 93 - if ($commit && $commit->isPartiallyImported($partial_import) && $data) { 94 - $summary = AphrontTableView::renderSingleDisplayLine( 95 - $history->getSummary()); 96 - } else { 97 - $summary = phutil_tag('em', array(), pht("Importing\xE2\x80\xA6")); 98 - } 99 - 100 - $build = null; 101 - if ($show_builds) { 102 - $buildable = idx($buildables, $commit->getPHID()); 103 - if ($buildable !== null) { 104 - $build = $this->renderBuildable($buildable); 105 - $has_any_build = true; 106 - } 107 - } 108 - 109 - $browse = $this->linkBrowse( 110 - $history->getPath(), 111 - array( 112 - 'commit' => $history->getCommitIdentifier(), 113 - 'branch' => $drequest->getBranch(), 114 - 'type' => $history->getFileType(), 115 - )); 116 - 117 - $status = $commit->getAuditStatusObject(); 118 - $icon = $status->getIcon(); 119 - $color = $status->getColor(); 120 - $name = $status->getName(); 121 - 122 - $audit_view = id(new PHUIIconView()) 123 - ->setIcon($icon, $color) 124 - ->addSigil('has-tooltip') 125 - ->setMetadata( 126 - array( 127 - 'tip' => $name, 128 - )); 129 - 130 - $revision_link = null; 131 - if ($commit) { 132 - $revisions = $this->getRevisionsForCommit($commit); 133 - if ($revisions) { 134 - $revision = head($revisions); 135 - $revision_link = phutil_tag( 136 - 'a', 137 - array( 138 - 'href' => $revision->getURI(), 139 - ), 140 - $revision->getMonogram()); 141 - } 142 - } 143 - 144 - $rows[] = array( 145 - $graph ? $graph[$ii++] : null, 146 - $browse, 147 - self::linkCommit( 148 - $drequest->getRepository(), 149 - $history->getCommitIdentifier()), 150 - $build, 151 - $audit_view, 152 - $revision_link, 153 - $author, 154 - $summary, 155 - $committed, 156 - ); 157 - } 158 - 159 - $view = new AphrontTableView($rows); 160 - $view->setHeaders( 161 - array( 162 - null, 163 - null, 164 - pht('Commit'), 165 - null, 166 - null, 167 - null, 168 - pht('Author'), 169 - pht('Details'), 170 - pht('Committed'), 171 - )); 172 - $view->setColumnClasses( 173 - array( 174 - 'threads', 175 - 'nudgeright', 176 - '', 177 - 'icon', 178 - 'icon', 179 - '', 180 - '', 181 - 'wide', 182 - 'right', 183 - )); 184 - $view->setColumnVisibility( 185 - array( 186 - $graph ? true : false, 187 - true, 188 - true, 189 - $has_any_build, 190 - true, 191 - $show_revisions, 192 - )); 193 - $view->setDeviceVisibility( 194 - array( 195 - $graph ? true : false, 196 - true, 197 - true, 198 - true, 199 - true, 200 - true, 201 - false, 202 - true, 203 - false, 204 - )); 205 - return $view->render(); 206 - } 207 - 208 - }
-117
src/applications/diffusion/view/DiffusionHistoryView.php
··· 1 - <?php 2 - 3 - abstract class DiffusionHistoryView extends DiffusionView { 4 - 5 - private $history; 6 - private $revisions = array(); 7 - private $handles = array(); 8 - private $isHead; 9 - private $isTail; 10 - private $parents; 11 - private $filterParents; 12 - private $revisionMap; 13 - 14 - public function setHistory(array $history) { 15 - assert_instances_of($history, 'DiffusionPathChange'); 16 - $this->history = $history; 17 - return $this; 18 - } 19 - 20 - public function getHistory() { 21 - return $this->history; 22 - } 23 - 24 - public function setHandles(array $handles) { 25 - assert_instances_of($handles, 'PhabricatorObjectHandle'); 26 - $this->handles = $handles; 27 - return $this; 28 - } 29 - 30 - public function getRequiredHandlePHIDs() { 31 - $phids = array(); 32 - foreach ($this->history as $item) { 33 - $data = $item->getCommitData(); 34 - if ($data) { 35 - if ($data->getCommitDetail('authorPHID')) { 36 - $phids[$data->getCommitDetail('authorPHID')] = true; 37 - } 38 - if ($data->getCommitDetail('committerPHID')) { 39 - $phids[$data->getCommitDetail('committerPHID')] = true; 40 - } 41 - } 42 - } 43 - return array_keys($phids); 44 - } 45 - 46 - public function setParents(array $parents) { 47 - $this->parents = $parents; 48 - return $this; 49 - } 50 - 51 - public function getParents() { 52 - return $this->parents; 53 - } 54 - 55 - public function setIsHead($is_head) { 56 - $this->isHead = $is_head; 57 - return $this; 58 - } 59 - 60 - public function getIsHead() { 61 - return $this->isHead; 62 - } 63 - 64 - public function setIsTail($is_tail) { 65 - $this->isTail = $is_tail; 66 - return $this; 67 - } 68 - 69 - public function getIsTail() { 70 - return $this->isTail; 71 - } 72 - 73 - public function setFilterParents($filter_parents) { 74 - $this->filterParents = $filter_parents; 75 - return $this; 76 - } 77 - 78 - public function getFilterParents() { 79 - return $this->filterParents; 80 - } 81 - 82 - public function render() {} 83 - 84 - final protected function getRevisionsForCommit( 85 - PhabricatorRepositoryCommit $commit) { 86 - 87 - if ($this->revisionMap === null) { 88 - $this->revisionMap = $this->newRevisionMap(); 89 - } 90 - 91 - return idx($this->revisionMap, $commit->getPHID(), array()); 92 - } 93 - 94 - private function newRevisionMap() { 95 - $history = $this->history; 96 - 97 - $commits = array(); 98 - foreach ($history as $item) { 99 - $commit = $item->getCommit(); 100 - if ($commit) { 101 - 102 - // NOTE: The "commit" objects in the history list may be undiscovered, 103 - // and thus not yet have PHIDs. Only load data for commits with PHIDs. 104 - if (!$commit->getPHID()) { 105 - continue; 106 - } 107 - 108 - $commits[] = $commit; 109 - } 110 - } 111 - 112 - return DiffusionCommitRevisionQuery::loadRevisionMapForCommits( 113 - $this->getViewer(), 114 - $commits); 115 - } 116 - 117 - }