Don't implement SVN over HTTP
Summary: Ref T2230. As far as I can tell, getting SVN working over HTTP is incredibly complicated. It's all DAV-based and doesn't appear to have any kind of binary we can just execute and pass requests through to. Don't support it for now. - Disable it in the UI. - Make sure all the error messages are reasonable. Test Plan: Tried to HTTP an SVN repo. Tried to clone a Git repo with SVN, got a good error message. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2230 Differential Revision: https://secure.phabricator.com/D7562
This commit is contained in:
@@ -126,6 +126,9 @@ final class DiffusionRepositoryEditHostingController
|
|||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
|
|
||||||
|
$type = $repository->getVersionControlSystem();
|
||||||
|
$is_svn = ($type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN);
|
||||||
|
|
||||||
$v_http_mode = $repository->getDetail(
|
$v_http_mode = $repository->getDetail(
|
||||||
'serve-over-http',
|
'serve-over-http',
|
||||||
PhabricatorRepository::SERVE_OFF);
|
PhabricatorRepository::SERVE_OFF);
|
||||||
@@ -146,9 +149,11 @@ final class DiffusionRepositoryEditHostingController
|
|||||||
$type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP;
|
$type_http = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_HTTP;
|
||||||
$type_ssh = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_SSH;
|
$type_ssh = PhabricatorRepositoryTransaction::TYPE_PROTOCOL_SSH;
|
||||||
|
|
||||||
$xactions[] = id(clone $template)
|
if (!$is_svn) {
|
||||||
->setTransactionType($type_http)
|
$xactions[] = id(clone $template)
|
||||||
->setNewValue($v_http_mode);
|
->setTransactionType($type_http)
|
||||||
|
->setNewValue($v_http_mode);
|
||||||
|
}
|
||||||
|
|
||||||
$xactions[] = id(clone $template)
|
$xactions[] = id(clone $template)
|
||||||
->setTransactionType($type_ssh)
|
->setTransactionType($type_ssh)
|
||||||
@@ -232,6 +237,18 @@ final class DiffusionRepositoryEditHostingController
|
|||||||
PhabricatorRepository::SERVE_READWRITE),
|
PhabricatorRepository::SERVE_READWRITE),
|
||||||
$rw_message);
|
$rw_message);
|
||||||
|
|
||||||
|
if ($is_svn) {
|
||||||
|
$http_control = id(new AphrontFormMarkupControl())
|
||||||
|
->setLabel(pht('HTTP'))
|
||||||
|
->setValue(
|
||||||
|
phutil_tag(
|
||||||
|
'em',
|
||||||
|
array(),
|
||||||
|
pht(
|
||||||
|
'Phabricator does not currently support HTTP access to '.
|
||||||
|
'Subversion repositories.')));
|
||||||
|
}
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->appendRemarkupInstructions(
|
->appendRemarkupInstructions(
|
||||||
|
|||||||
@@ -172,18 +172,53 @@ final class DiffusionServeController extends DiffusionController {
|
|||||||
pht('This repository is not available over HTTP.'));
|
pht('This repository is not available over HTTP.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($repository->getVersionControlSystem()) {
|
$vcs_type = $repository->getVersionControlSystem();
|
||||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
$req_type = $this->isVCSRequest($request);
|
||||||
$result = $this->serveGitRequest($repository, $viewer);
|
|
||||||
break;
|
if ($vcs_type != $req_type) {
|
||||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
switch ($req_type) {
|
||||||
$result = $this->serveMercurialRequest($repository, $viewer);
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||||
break;
|
$result = new PhabricatorVCSResponse(
|
||||||
default:
|
500,
|
||||||
$result = new PhabricatorVCSResponse(
|
pht('This is not a Git repository.'));
|
||||||
999,
|
break;
|
||||||
pht('TODO: Implement meaningful responses.'));
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||||
break;
|
$result = new PhabricatorVCSResponse(
|
||||||
|
500,
|
||||||
|
pht('This is not a Mercurial repository.'));
|
||||||
|
break;
|
||||||
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||||
|
$result = new PhabricatorVCSResponse(
|
||||||
|
500,
|
||||||
|
pht('This is not a Subversion repository.'));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result = new PhabricatorVCSResponse(
|
||||||
|
500,
|
||||||
|
pht('Unknown request type.'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch ($vcs_type) {
|
||||||
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||||
|
$result = $this->serveGitRequest($repository, $viewer);
|
||||||
|
break;
|
||||||
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||||
|
$result = $this->serveMercurialRequest($repository, $viewer);
|
||||||
|
break;
|
||||||
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||||
|
$result = new PhabricatorVCSResponse(
|
||||||
|
500,
|
||||||
|
pht(
|
||||||
|
'Phabricator does not support HTTP access to Subversion '.
|
||||||
|
'repositories.'));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result = new PhabricatorVCSResponse(
|
||||||
|
500,
|
||||||
|
pht('Unknown version control system.'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$code = $result->getHTTPResponseCode();
|
$code = $result->getHTTPResponseCode();
|
||||||
@@ -232,7 +267,7 @@ final class DiffusionServeController extends DiffusionController {
|
|||||||
return DiffusionMercurialWireProtocol::isReadOnlyBatchCommand($cmds);
|
return DiffusionMercurialWireProtocol::isReadOnlyBatchCommand($cmds);
|
||||||
}
|
}
|
||||||
return DiffusionMercurialWireProtocol::isReadOnlyCommand($cmd);
|
return DiffusionMercurialWireProtocol::isReadOnlyCommand($cmd);
|
||||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SUBVERSION:
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -757,6 +757,9 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getServeOverHTTP() {
|
public function getServeOverHTTP() {
|
||||||
|
if ($this->isSVN()) {
|
||||||
|
return self::SERVE_OFF;
|
||||||
|
}
|
||||||
$serve = $this->getDetail('serve-over-http', self::SERVE_OFF);
|
$serve = $this->getDetail('serve-over-http', self::SERVE_OFF);
|
||||||
return $this->normalizeServeConfigSetting($serve);
|
return $this->normalizeServeConfigSetting($serve);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user