@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 branch status more clear on Diffusion branches view

Summary:
See PHI1225. Ref T13277. In Diffusion, show "default", "permanent", or "not permanent" when looking at branches.

For repositories with 100 or fewer branches, put default and permanent branches on top.

Test Plan: {F6426814}

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: leoluk

Maniphest Tasks: T13277

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

+51 -2
+40
src/applications/diffusion/controller/DiffusionBranchTableController.php
··· 37 37 38 38 $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches); 39 39 40 + // If there is one page of results or fewer, sort branches so the default 41 + // branch is on top and permanent branches are below it. 42 + if (!$pager->getOffset() && !$pager->getHasMorePages()) { 43 + $branches = $this->sortBranches($repository, $branches); 44 + } 45 + 40 46 $content = null; 41 47 if (!$branches) { 42 48 $content = $this->renderStatusMessage( ··· 95 101 )) 96 102 ->setCrumbs($crumbs) 97 103 ->appendChild($view); 104 + } 105 + 106 + private function sortBranches( 107 + PhabricatorRepository $repository, 108 + array $branches) { 109 + 110 + $publisher = $repository->newPublisher(); 111 + $default_branch = $repository->getDefaultBranch(); 112 + 113 + $vectors = array(); 114 + foreach ($branches as $key => $branch) { 115 + $short_name = $branch->getShortName(); 116 + 117 + if ($short_name === $default_branch) { 118 + $order_default = 0; 119 + } else { 120 + $order_default = 1; 121 + } 122 + 123 + if ($publisher->shouldPublishRef($branch)) { 124 + $order_permanent = 0; 125 + } else { 126 + $order_permanent = 1; 127 + } 128 + 129 + $vectors[$key] = id(new PhutilSortVector()) 130 + ->addInt($order_default) 131 + ->addInt($order_permanent) 132 + ->addString($short_name); 133 + } 134 + 135 + $vectors = msortv($vectors, 'getSelf'); 136 + 137 + return array_select_keys($branches, array_keys($vectors)); 98 138 } 99 139 100 140 }
+11 -2
src/applications/diffusion/view/DiffusionBranchListView.php
··· 33 33 Javelin::initBehavior('phabricator-tooltips'); 34 34 35 35 $list = id(new PHUIObjectItemListView()) 36 - ->setFlush(true) 37 36 ->addClass('diffusion-history-list') 38 37 ->addClass('diffusion-branch-list'); 38 + 39 + $publisher = $repository->newPublisher(); 39 40 40 41 foreach ($this->branches as $branch) { 41 42 $build_view = null; ··· 116 117 )); 117 118 118 119 if ($branch->getShortName() == $repository->getDefaultBranch()) { 119 - $item->setStatusIcon('fa-code-fork', pht('Default Branch')); 120 + $item->setStatusIcon('fa-star', pht('Default Branch')); 121 + } else { 122 + if ($publisher->shouldPublishRef($branch)) { 123 + $item->setStatusIcon('fa-code-fork', pht('Permanent Ref')); 124 + } else { 125 + $item->setStatusIcon( 126 + 'fa-folder-open-o grey', pht('Not a Permanent Ref')); 127 + } 120 128 } 129 + 121 130 $item->addAttribute(array($datetime)); 122 131 123 132 if ($can_close_branches) {