1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-05 20:31:03 +01:00
phorge-phorge/src/applications/diffusion/request/DiffusionGitRequest.php
epriestley 4c2696120b Remove DiffusionBranchInformation in favor of DiffusionRepositoryRef
Summary: Ref T4327. At some point these two very similar classes got introduced. Collapse `DiffusionBranchInformation` into the nearly identical `DiffusionRepositoryRef`, which enjoys slightly more generality and support.

Test Plan: Viewed branch overview and detail pages. Ran `repository refs` and `repository discover`. Grepped for removed symbols.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4327

Differential Revision: https://secure.phabricator.com/D8002
2014-01-17 16:10:56 -08:00

47 lines
927 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;
}
return $this->getResolvableBranchName($this->getBranch());
}
protected function getResolvableBranchName($branch) {
if ($this->repository->isWorkingCopyBare()) {
return $branch;
} else {
$remote = DiffusionGitBranch::DEFAULT_GIT_REMOTE;
return $remote.'/'.$branch;
}
}
}