mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Restore edit UI for "Import Only" in Subversion
Summary: Ref T10923. Although I'd ideally like to get rid of this eventually, keep it around for now. Test Plan: - Edited value for an SVN repository. - Observed no panel present for a Git repository. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10923 Differential Revision: https://secure.phabricator.com/D15883
This commit is contained in:
parent
3fdb1a2bc4
commit
97c103fa00
3 changed files with 95 additions and 0 deletions
|
@ -775,6 +775,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php',
|
'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php',
|
||||||
'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php',
|
'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php',
|
||||||
'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php',
|
'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php',
|
||||||
|
'DiffusionRepositorySubversionManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php',
|
||||||
'DiffusionRepositorySymbolsManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php',
|
'DiffusionRepositorySymbolsManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php',
|
||||||
'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php',
|
'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php',
|
||||||
'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php',
|
'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php',
|
||||||
|
@ -4995,6 +4996,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
|
'DiffusionRepositorySubversionManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryTag' => 'Phobject',
|
'DiffusionRepositoryTag' => 'Phobject',
|
||||||
'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryManageController',
|
'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryManageController',
|
||||||
|
|
|
@ -226,6 +226,11 @@ final class DiffusionRepositoryEditEngine
|
||||||
"IMPORTANT: This feature is new, experimental, and not supported. ".
|
"IMPORTANT: This feature is new, experimental, and not supported. ".
|
||||||
"Use it at your own risk.");
|
"Use it at your own risk.");
|
||||||
|
|
||||||
|
$subpath_instructions = pht(
|
||||||
|
'If you want to import only part of a repository, like `trunk/`, '.
|
||||||
|
'you can set a path in **Import Only**. Phabricator will ignore '.
|
||||||
|
'commits which do not affect this path.');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
id(new PhabricatorSelectEditField())
|
id(new PhabricatorSelectEditField())
|
||||||
->setKey('vcs')
|
->setKey('vcs')
|
||||||
|
@ -338,6 +343,17 @@ final class DiffusionRepositoryEditEngine
|
||||||
->setConduitDescription(pht('Set the autoclose branches.'))
|
->setConduitDescription(pht('Set the autoclose branches.'))
|
||||||
->setConduitTypeDescription(pht('New default tracked branchs.'))
|
->setConduitTypeDescription(pht('New default tracked branchs.'))
|
||||||
->setValue($autoclose_value),
|
->setValue($autoclose_value),
|
||||||
|
id(new PhabricatorTextEditField())
|
||||||
|
->setKey('importOnly')
|
||||||
|
->setLabel(pht('Import Only'))
|
||||||
|
->setTransactionType(
|
||||||
|
PhabricatorRepositoryTransaction::TYPE_SVN_SUBPATH)
|
||||||
|
->setIsCopyable(true)
|
||||||
|
->setDescription(pht('Subpath to selectively import.'))
|
||||||
|
->setConduitDescription(pht('Set the subpath to import.'))
|
||||||
|
->setConduitTypeDescription(pht('New subpath to import.'))
|
||||||
|
->setValue($object->getDetail('svn-subpath'))
|
||||||
|
->setControlInstructions($subpath_instructions),
|
||||||
id(new PhabricatorTextEditField())
|
id(new PhabricatorTextEditField())
|
||||||
->setKey('stagingAreaURI')
|
->setKey('stagingAreaURI')
|
||||||
->setLabel(pht('Staging Area URI'))
|
->setLabel(pht('Staging Area URI'))
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositorySubversionManagementPanel
|
||||||
|
extends DiffusionRepositoryManagementPanel {
|
||||||
|
|
||||||
|
const PANELKEY = 'subversion';
|
||||||
|
|
||||||
|
public function getManagementPanelLabel() {
|
||||||
|
return pht('Subversion');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelOrder() {
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function shouldEnableForRepository(
|
||||||
|
PhabricatorRepository $repository) {
|
||||||
|
return $repository->isSVN();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelIcon() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
|
||||||
|
$has_any = (bool)$repository->getDetail('svn-subpath');
|
||||||
|
|
||||||
|
if ($has_any) {
|
||||||
|
return 'fa-database';
|
||||||
|
} else {
|
||||||
|
return 'fa-database grey';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getEditEngineFieldKeys() {
|
||||||
|
return array(
|
||||||
|
'importOnly',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildManagementPanelActions() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$repository,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
|
$subversion_uri = $this->getEditPageURI();
|
||||||
|
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setName(pht('Edit Properties'))
|
||||||
|
->setHref($subversion_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('svn-subpath'),
|
||||||
|
phutil_tag('em', array(), pht('Import Entire Repository')));
|
||||||
|
$view->addProperty(pht('Import Only'), $default_branch);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->newBox(pht('Subversion'), $view);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue