mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
2f44c0fac9
Summary: Ref T2784. This is a lower-level one from drequest so it gets the conditional initialization treatment. Consolidated SVN as well even though SVN is issuing database queries; I felt better about the code de-duplication despite the small performance hit when we could just query the DB directly in the SVN case. Test Plan: browsed around my Phabricator repositories in Mercurial, Git, and SVN flavors. Looked good. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2784 Differential Revision: https://secure.phabricator.com/D5956
38 lines
726 B
PHP
38 lines
726 B
PHP
<?php
|
|
|
|
/**
|
|
* @group diffusion
|
|
*/
|
|
final class DiffusionGitRequest extends DiffusionRequest {
|
|
|
|
protected function getSupportsBranches() {
|
|
return true;
|
|
}
|
|
|
|
protected function didInitialize() {
|
|
if (!$this->commit) {
|
|
return;
|
|
}
|
|
|
|
$this->expandCommitName();
|
|
}
|
|
|
|
public function getBranch() {
|
|
if ($this->branch) {
|
|
return $this->branch;
|
|
}
|
|
if ($this->repository) {
|
|
return $this->repository->getDefaultBranch();
|
|
}
|
|
throw new Exception("Unable to determine branch!");
|
|
}
|
|
|
|
public function getCommit() {
|
|
if ($this->commit) {
|
|
return $this->commit;
|
|
}
|
|
$remote = DiffusionBranchInformation::DEFAULT_GIT_REMOTE;
|
|
return $remote.'/'.$this->getBranch();
|
|
}
|
|
|
|
}
|