2012-07-31 16:27:48 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionCommitBranchesController extends DiffusionController {
|
|
|
|
|
2013-09-27 10:49:45 -07:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-05 08:13:05 -08:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
$response = $this->loadDiffusionContext();
|
|
|
|
if ($response) {
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2015-01-09 13:29:08 -08:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
2015-02-17 14:01:17 -08:00
|
|
|
$repository = $drequest->getRepository();
|
2012-07-31 16:27:48 -07:00
|
|
|
|
2015-02-17 14:01:17 -08:00
|
|
|
switch ($repository->getVersionControlSystem()) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
$branches = array();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$branches = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.branchquery',
|
|
|
|
array(
|
|
|
|
'contains' => $drequest->getCommit(),
|
|
|
|
));
|
|
|
|
break;
|
2013-05-20 17:04:51 -07:00
|
|
|
}
|
2012-07-31 16:27:48 -07:00
|
|
|
|
2014-01-17 16:11:04 -08:00
|
|
|
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
|
2012-07-31 16:27:48 -07:00
|
|
|
$branch_links = array();
|
2014-01-17 16:11:04 -08:00
|
|
|
foreach ($branches as $branch) {
|
2013-01-17 18:43:35 -08:00
|
|
|
$branch_links[] = phutil_tag(
|
2012-07-31 16:27:48 -07:00
|
|
|
'a',
|
|
|
|
array(
|
2015-01-09 13:29:08 -08:00
|
|
|
'href' => $drequest->generateURI(
|
2012-07-31 16:27:48 -07:00
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
2014-01-17 16:11:04 -08:00
|
|
|
'branch' => $branch->getShortName(),
|
2012-07-31 16:27:48 -07:00
|
|
|
)),
|
|
|
|
),
|
2014-01-17 16:11:04 -08:00
|
|
|
$branch->getShortName());
|
2012-07-31 16:27:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return id(new AphrontAjaxResponse())
|
2015-05-22 17:27:56 +10:00
|
|
|
->setContent($branch_links ? implode(', ', $branch_links) : pht('None'));
|
2012-07-31 16:27:48 -07:00
|
|
|
}
|
|
|
|
}
|