Page MenuHomePhabricator

D15809.diff
No OneTemporary

D15809.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -745,6 +745,7 @@
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
'DiffusionRepositoryAutomationManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php',
'DiffusionRepositoryBasicsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php',
+ 'DiffusionRepositoryBranchesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php',
'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php',
'DiffusionRepositoryClusterEngine' => 'applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php',
'DiffusionRepositoryClusterEngineLogInterface' => 'applications/diffusion/protocol/DiffusionRepositoryClusterEngineLogInterface.php',
@@ -4964,6 +4965,7 @@
'DiffusionRenameHistoryQuery' => 'Phobject',
'DiffusionRepositoryAutomationManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel',
+ 'DiffusionRepositoryBranchesManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'DiffusionRepositoryClusterEngine' => 'Phobject',
'DiffusionRepositoryController' => 'DiffusionController',
diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
--- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
+++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
@@ -75,6 +75,12 @@
->setObject($object)
->execute();
+ $track_value = $object->getDetail('branch-filter', array());
+ $track_value = array_keys($track_value);
+
+ $autoclose_value = $object->getDetail('close-commits-filter', array());
+ $autoclose_value = array_keys($autoclose_value);
+
return array(
id(new PhabricatorSelectEditField())
->setKey('vcs')
@@ -162,6 +168,28 @@
->setConduitDescription(pht('Set the default branch name.'))
->setConduitTypeDescription(pht('New default branch name.'))
->setValue($object->getDetail('default-branch')),
+ id(new PhabricatorTextAreaEditField())
+ ->setIsStringList(true)
+ ->setKey('trackOnly')
+ ->setLabel(pht('Track Only'))
+ ->setTransactionType(
+ PhabricatorRepositoryTransaction::TYPE_TRACK_ONLY)
+ ->setIsCopyable(true)
+ ->setDescription(pht('Track only these branches.'))
+ ->setConduitDescription(pht('Set the tracked branches.'))
+ ->setConduitTypeDescription(pht('New tracked branchs.'))
+ ->setValue($track_value),
+ id(new PhabricatorTextAreaEditField())
+ ->setIsStringList(true)
+ ->setKey('autocloseOnly')
+ ->setLabel(pht('Autoclose Only'))
+ ->setTransactionType(
+ PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE_ONLY)
+ ->setIsCopyable(true)
+ ->setDescription(pht('Autoclose commits on only these branches.'))
+ ->setConduitDescription(pht('Set the autoclose branches.'))
+ ->setConduitTypeDescription(pht('New default tracked branchs.'))
+ ->setValue($autoclose_value),
id(new PhabricatorTextEditField())
->setKey('stagingAreaURI')
->setLabel(pht('Staging Area URI'))
diff --git a/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
@@ -0,0 +1,68 @@
+<?php
+
+final class DiffusionRepositoryBranchesManagementPanel
+ extends DiffusionRepositoryManagementPanel {
+
+ const PANELKEY = 'branches';
+
+ public function getManagementPanelLabel() {
+ return pht('Branches');
+ }
+
+ public function getManagementPanelOrder() {
+ return 1000;
+ }
+
+ protected function buildManagementPanelActions() {
+ $repository = $this->getRepository();
+ $viewer = $this->getViewer();
+
+ $can_edit = PhabricatorPolicyFilter::hasCapability(
+ $viewer,
+ $repository,
+ PhabricatorPolicyCapability::CAN_EDIT);
+
+ $branches_uri = $repository->getPathURI('edit/branches/');
+
+ return array(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-pencil')
+ ->setName(pht('Edit Branches'))
+ ->setHref($branches_uri)
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(!$can_edit),
+ );
+ }
+
+ public function buildManagementPanelContent() {
+ $repository = $this->getRepository();
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setViewer($viewer)
+ ->setActionList($this->newActions());
+
+ $default_branch = nonempty(
+ $repository->getHumanReadableDetail('default-branch'),
+ phutil_tag('em', array(), $repository->getDefaultBranch()));
+ $view->addProperty(pht('Default Branch'), $default_branch);
+
+ $track_only = nonempty(
+ $repository->getHumanReadableDetail('branch-filter', array()),
+ phutil_tag('em', array(), pht('Track All Branches')));
+ $view->addProperty(pht('Track Only'), $track_only);
+
+ $autoclose_only = nonempty(
+ $repository->getHumanReadableDetail('close-commits-filter', array()),
+ phutil_tag('em', array(), pht('Autoclose On All Branches')));
+
+ if ($repository->getDetail('disable-autoclose')) {
+ $autoclose_only = phutil_tag('em', array(), pht('Disabled'));
+ }
+
+ $view->addProperty(pht('Autoclose Only'), $autoclose_only);
+
+ return $this->newBox(pht('Branches'), $view);
+ }
+
+}
diff --git a/src/applications/transactions/editfield/PhabricatorTextAreaEditField.php b/src/applications/transactions/editfield/PhabricatorTextAreaEditField.php
--- a/src/applications/transactions/editfield/PhabricatorTextAreaEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorTextAreaEditField.php
@@ -5,6 +5,7 @@
private $monospaced;
private $height;
+ private $isStringList;
public function setMonospaced($monospaced) {
$this->monospaced = $monospaced;
@@ -24,6 +25,15 @@
return $this->height;
}
+ public function setIsStringList($is_string_list) {
+ $this->isStringList = $is_string_list;
+ return $this;
+ }
+
+ public function getIsStringList() {
+ return $this->isStringList;
+ }
+
protected function newControl() {
$control = new AphrontFormTextAreaControl();
@@ -39,8 +49,25 @@
return $control;
}
+ protected function getValueForControl() {
+ $value = $this->getValue();
+ return implode("\n", $value);
+ }
+
protected function newConduitParameterType() {
- return new ConduitStringParameterType();
+ if ($this->getIsStringList()) {
+ return new ConduitStringListParameterType();
+ } else {
+ return new ConduitStringParameterType();
+ }
+ }
+
+ protected function newHTTPParameterType() {
+ if ($this->getIsStringList()) {
+ return new AphrontStringListHTTPParameterType();
+ } else {
+ return new AphrontStringHTTPParameterType();
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 14, 9:37 PM (4 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727044
Default Alt Text
D15809.diff (7 KB)

Event Timeline