Support SVN pre-commit hoooks
Summary: Ref T4189. This adds SVN support, which was a little more messy than I though. Principally, we can not use `PHABRICATOR_USER` for Subversion, because it strips away the entire environment for "security reasons". Instead, use `--tunnel-user` plus `svnlook author` to figure out the author. Also fix "ssh://" clone URIs, which needs to be "svn+ssh://". Test Plan: - Made SVN commits through the hook. - Made Git commits, too, to make sure I didn't break anything. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4189 Differential Revision: https://secure.phabricator.com/D7683
This commit is contained in:
@@ -5,6 +5,15 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||
private $viewer;
|
||||
private $repository;
|
||||
private $stdin;
|
||||
private $subversionTransaction;
|
||||
private $subversionRepository;
|
||||
|
||||
|
||||
public function setSubversionTransactionInfo($transaction, $repository) {
|
||||
$this->subversionTransaction = $transaction;
|
||||
$this->subversionRepository = $repository;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStdin($stdin) {
|
||||
$this->stdin = $stdin;
|
||||
@@ -39,6 +48,9 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||
$err = $this->executeGitHook();
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
$err = $this->executeSubversionHook();
|
||||
break;
|
||||
default:
|
||||
throw new Exception(pht('Unsupported repository type "%s"!', $type));
|
||||
}
|
||||
@@ -54,6 +66,13 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function executeSubversionHook() {
|
||||
|
||||
// TODO: Do useful things here, too.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function parseGitUpdates($stdin) {
|
||||
$updates = array();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user