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

Port Repository "Branches" to new UI

Summary: Ref T10748. Makes a "Branches" panel, enables these transactions in the EditEngine.

Test Plan:
- Edited via EditEngine + Conduit.
- Viewed via manage UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10748

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

+126 -1
+2
src/__phutil_library_map__.php
··· 745 745 'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php', 746 746 'DiffusionRepositoryAutomationManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php', 747 747 'DiffusionRepositoryBasicsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php', 748 + 'DiffusionRepositoryBranchesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php', 748 749 'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php', 749 750 'DiffusionRepositoryClusterEngine' => 'applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php', 750 751 'DiffusionRepositoryClusterEngineLogInterface' => 'applications/diffusion/protocol/DiffusionRepositoryClusterEngineLogInterface.php', ··· 4964 4965 'DiffusionRenameHistoryQuery' => 'Phobject', 4965 4966 'DiffusionRepositoryAutomationManagementPanel' => 'DiffusionRepositoryManagementPanel', 4966 4967 'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel', 4968 + 'DiffusionRepositoryBranchesManagementPanel' => 'DiffusionRepositoryManagementPanel', 4967 4969 'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule', 4968 4970 'DiffusionRepositoryClusterEngine' => 'Phobject', 4969 4971 'DiffusionRepositoryController' => 'DiffusionController',
+28
src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
··· 75 75 ->setObject($object) 76 76 ->execute(); 77 77 78 + $track_value = $object->getDetail('branch-filter', array()); 79 + $track_value = array_keys($track_value); 80 + 81 + $autoclose_value = $object->getDetail('close-commits-filter', array()); 82 + $autoclose_value = array_keys($autoclose_value); 83 + 78 84 return array( 79 85 id(new PhabricatorSelectEditField()) 80 86 ->setKey('vcs') ··· 162 168 ->setConduitDescription(pht('Set the default branch name.')) 163 169 ->setConduitTypeDescription(pht('New default branch name.')) 164 170 ->setValue($object->getDetail('default-branch')), 171 + id(new PhabricatorTextAreaEditField()) 172 + ->setIsStringList(true) 173 + ->setKey('trackOnly') 174 + ->setLabel(pht('Track Only')) 175 + ->setTransactionType( 176 + PhabricatorRepositoryTransaction::TYPE_TRACK_ONLY) 177 + ->setIsCopyable(true) 178 + ->setDescription(pht('Track only these branches.')) 179 + ->setConduitDescription(pht('Set the tracked branches.')) 180 + ->setConduitTypeDescription(pht('New tracked branchs.')) 181 + ->setValue($track_value), 182 + id(new PhabricatorTextAreaEditField()) 183 + ->setIsStringList(true) 184 + ->setKey('autocloseOnly') 185 + ->setLabel(pht('Autoclose Only')) 186 + ->setTransactionType( 187 + PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE_ONLY) 188 + ->setIsCopyable(true) 189 + ->setDescription(pht('Autoclose commits on only these branches.')) 190 + ->setConduitDescription(pht('Set the autoclose branches.')) 191 + ->setConduitTypeDescription(pht('New default tracked branchs.')) 192 + ->setValue($autoclose_value), 165 193 id(new PhabricatorTextEditField()) 166 194 ->setKey('stagingAreaURI') 167 195 ->setLabel(pht('Staging Area URI'))
+68
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
··· 1 + <?php 2 + 3 + final class DiffusionRepositoryBranchesManagementPanel 4 + extends DiffusionRepositoryManagementPanel { 5 + 6 + const PANELKEY = 'branches'; 7 + 8 + public function getManagementPanelLabel() { 9 + return pht('Branches'); 10 + } 11 + 12 + public function getManagementPanelOrder() { 13 + return 1000; 14 + } 15 + 16 + protected function buildManagementPanelActions() { 17 + $repository = $this->getRepository(); 18 + $viewer = $this->getViewer(); 19 + 20 + $can_edit = PhabricatorPolicyFilter::hasCapability( 21 + $viewer, 22 + $repository, 23 + PhabricatorPolicyCapability::CAN_EDIT); 24 + 25 + $branches_uri = $repository->getPathURI('edit/branches/'); 26 + 27 + return array( 28 + id(new PhabricatorActionView()) 29 + ->setIcon('fa-pencil') 30 + ->setName(pht('Edit Branches')) 31 + ->setHref($branches_uri) 32 + ->setDisabled(!$can_edit) 33 + ->setWorkflow(!$can_edit), 34 + ); 35 + } 36 + 37 + public function buildManagementPanelContent() { 38 + $repository = $this->getRepository(); 39 + $viewer = $this->getViewer(); 40 + 41 + $view = id(new PHUIPropertyListView()) 42 + ->setViewer($viewer) 43 + ->setActionList($this->newActions()); 44 + 45 + $default_branch = nonempty( 46 + $repository->getHumanReadableDetail('default-branch'), 47 + phutil_tag('em', array(), $repository->getDefaultBranch())); 48 + $view->addProperty(pht('Default Branch'), $default_branch); 49 + 50 + $track_only = nonempty( 51 + $repository->getHumanReadableDetail('branch-filter', array()), 52 + phutil_tag('em', array(), pht('Track All Branches'))); 53 + $view->addProperty(pht('Track Only'), $track_only); 54 + 55 + $autoclose_only = nonempty( 56 + $repository->getHumanReadableDetail('close-commits-filter', array()), 57 + phutil_tag('em', array(), pht('Autoclose On All Branches'))); 58 + 59 + if ($repository->getDetail('disable-autoclose')) { 60 + $autoclose_only = phutil_tag('em', array(), pht('Disabled')); 61 + } 62 + 63 + $view->addProperty(pht('Autoclose Only'), $autoclose_only); 64 + 65 + return $this->newBox(pht('Branches'), $view); 66 + } 67 + 68 + }
+28 -1
src/applications/transactions/editfield/PhabricatorTextAreaEditField.php
··· 5 5 6 6 private $monospaced; 7 7 private $height; 8 + private $isStringList; 8 9 9 10 public function setMonospaced($monospaced) { 10 11 $this->monospaced = $monospaced; ··· 24 25 return $this->height; 25 26 } 26 27 28 + public function setIsStringList($is_string_list) { 29 + $this->isStringList = $is_string_list; 30 + return $this; 31 + } 32 + 33 + public function getIsStringList() { 34 + return $this->isStringList; 35 + } 36 + 27 37 protected function newControl() { 28 38 $control = new AphrontFormTextAreaControl(); 29 39 ··· 37 47 } 38 48 39 49 return $control; 50 + } 51 + 52 + protected function getValueForControl() { 53 + $value = $this->getValue(); 54 + return implode("\n", $value); 40 55 } 41 56 42 57 protected function newConduitParameterType() { 43 - return new ConduitStringParameterType(); 58 + if ($this->getIsStringList()) { 59 + return new ConduitStringListParameterType(); 60 + } else { 61 + return new ConduitStringParameterType(); 62 + } 63 + } 64 + 65 + protected function newHTTPParameterType() { 66 + if ($this->getIsStringList()) { 67 + return new AphrontStringListHTTPParameterType(); 68 + } else { 69 + return new AphrontStringHTTPParameterType(); 70 + } 44 71 } 45 72 46 73 }