mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 12:42:43 +01:00
347252fda8
Summary: Ref T2683. Currently, DiffusionRequest has four different "commitey" things: - `commit` - `rawCommit` - `symbolicCommit` - `stableCommit` Of these, only two are actually distinct, useful values: `symbolicCommit` (which holds the value the request originally contained, if one existed) and `stableCommit` (which resolves that value, or the value implied by its omission, into a stable, permanent commit identifier). - `rawCommit` is equivalent to `symbolicCommit` and can be simply removed. - `commit` has some sketchy magic around it that needs to be pulled out before it can be jettisoned. Test Plan: Viewed SVN, Git, and Mercurial repositories. Viewed brwose/history/change/tag/branch/etc views. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2683 Differential Revision: https://secure.phabricator.com/D9098
32 lines
722 B
PHP
32 lines
722 B
PHP
<?php
|
|
|
|
final class DiffusionGitRequest extends DiffusionRequest {
|
|
|
|
protected function getSupportsBranches() {
|
|
return true;
|
|
}
|
|
|
|
protected function isStableCommit($symbol) {
|
|
return preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
|
}
|
|
|
|
public function getBranch() {
|
|
if ($this->branch) {
|
|
return $this->branch;
|
|
}
|
|
if ($this->repository) {
|
|
return $this->repository->getDefaultBranch();
|
|
}
|
|
throw new Exception("Unable to determine branch!");
|
|
}
|
|
|
|
protected function getResolvableBranchName($branch) {
|
|
if ($this->repository->isWorkingCopyBare()) {
|
|
return $branch;
|
|
} else {
|
|
$remote = DiffusionGitBranch::DEFAULT_GIT_REMOTE;
|
|
return $remote.'/'.$branch;
|
|
}
|
|
}
|
|
|
|
}
|