mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Hide irrelevant panels in Mercurial/Subversion, fix Subversion URIs
Summary: Ref T10923. - Hide "Automation", "Staging" and "Branches" in repositories where they do nothing. - Fix SVN SSH URIs to read "svn+ssh://" and have proper paths. Test Plan: - Verified irrelevant sections did not appear in Subversion in Manage UI. - Checked out a new hosted SVN repository. Reviewers: chad, avivey Reviewed By: avivey Maniphest Tasks: T10923 Differential Revision: https://secure.phabricator.com/D15874
This commit is contained in:
parent
e2bbde9675
commit
0b5ab2330d
6 changed files with 35 additions and 2 deletions
|
@ -27,11 +27,16 @@ final class DiffusionRepositoryManagePanelsController
|
|||
|
||||
$panels = DiffusionRepositoryManagementPanel::getAllPanels();
|
||||
|
||||
foreach ($panels as $panel) {
|
||||
foreach ($panels as $key => $panel) {
|
||||
$panel
|
||||
->setViewer($viewer)
|
||||
->setRepository($repository)
|
||||
->setController($this);
|
||||
|
||||
if (!$panel->shouldEnableForRepository($repository)) {
|
||||
unset($panels[$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$selected = $request->getURIData('panel');
|
||||
|
|
|
@ -13,6 +13,11 @@ final class DiffusionRepositoryAutomationManagementPanel
|
|||
return 800;
|
||||
}
|
||||
|
||||
public function shouldEnableForRepository(
|
||||
PhabricatorRepository $repository) {
|
||||
return $repository->isGit();
|
||||
}
|
||||
|
||||
protected function getEditEngineFieldKeys() {
|
||||
return array(
|
||||
'automationBlueprintPHIDs',
|
||||
|
|
|
@ -13,6 +13,11 @@ final class DiffusionRepositoryBranchesManagementPanel
|
|||
return 1000;
|
||||
}
|
||||
|
||||
public function shouldEnableForRepository(
|
||||
PhabricatorRepository $repository) {
|
||||
return ($repository->isGit() || $repository->isHg());
|
||||
}
|
||||
|
||||
public function getManagementPanelIcon() {
|
||||
$repository = $this->getRepository();
|
||||
|
||||
|
|
|
@ -46,6 +46,11 @@ abstract class DiffusionRepositoryManagementPanel
|
|||
return array();
|
||||
}
|
||||
|
||||
public function shouldEnableForRepository(
|
||||
PhabricatorRepository $repository) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final protected function newActions() {
|
||||
$actions = $this->buildManagementPanelActions();
|
||||
if (!$actions) {
|
||||
|
|
|
@ -13,6 +13,12 @@ final class DiffusionRepositoryStagingManagementPanel
|
|||
return 700;
|
||||
}
|
||||
|
||||
public function shouldEnableForRepository(
|
||||
PhabricatorRepository $repository) {
|
||||
return $repository->isGit();
|
||||
}
|
||||
|
||||
|
||||
public function getManagementPanelIcon() {
|
||||
$repository = $this->getRepository();
|
||||
|
||||
|
|
|
@ -310,9 +310,15 @@ final class PhabricatorRepositoryURI
|
|||
|
||||
|
||||
private function getForcedProtocol() {
|
||||
$repository = $this->getRepository();
|
||||
|
||||
switch ($this->getBuiltinProtocol()) {
|
||||
case self::BUILTIN_PROTOCOL_SSH:
|
||||
return 'ssh';
|
||||
if ($repository->isSVN()) {
|
||||
return 'svn+ssh';
|
||||
} else {
|
||||
return 'ssh';
|
||||
}
|
||||
case self::BUILTIN_PROTOCOL_HTTP:
|
||||
return 'http';
|
||||
case self::BUILTIN_PROTOCOL_HTTPS:
|
||||
|
@ -382,6 +388,7 @@ final class PhabricatorRepositoryURI
|
|||
$suffix = '/';
|
||||
} else {
|
||||
$suffix = '';
|
||||
$clone_name = '';
|
||||
}
|
||||
|
||||
switch ($this->getBuiltinIdentifier()) {
|
||||
|
|
Loading…
Reference in a new issue