2012-08-01 01:27:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionCommitBranchesController extends DiffusionController {
|
|
|
|
|
2013-09-27 19:49:45 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-09 22:29:08 +01:00
|
|
|
protected function processDiffusionRequest(AphrontRequest $request) {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
2015-02-17 23:01:17 +01:00
|
|
|
$repository = $drequest->getRepository();
|
2012-08-01 01:27:48 +02:00
|
|
|
|
2015-02-17 23:01:17 +01: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-21 02:04:51 +02:00
|
|
|
}
|
2012-08-01 01:27:48 +02:00
|
|
|
|
2014-01-18 01:11:04 +01:00
|
|
|
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
|
2012-08-01 01:27:48 +02:00
|
|
|
$branch_links = array();
|
2014-01-18 01:11:04 +01:00
|
|
|
foreach ($branches as $branch) {
|
2013-01-18 03:43:35 +01:00
|
|
|
$branch_links[] = phutil_tag(
|
2012-08-01 01:27:48 +02:00
|
|
|
'a',
|
|
|
|
array(
|
2015-01-09 22:29:08 +01:00
|
|
|
'href' => $drequest->generateURI(
|
2012-08-01 01:27:48 +02:00
|
|
|
array(
|
|
|
|
'action' => 'browse',
|
2014-01-18 01:11:04 +01:00
|
|
|
'branch' => $branch->getShortName(),
|
2012-08-01 01:27:48 +02:00
|
|
|
)),
|
|
|
|
),
|
2014-01-18 01:11:04 +01:00
|
|
|
$branch->getShortName());
|
2012-08-01 01:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
|
|
->setContent($branch_links ? implode(', ', $branch_links) : 'None');
|
|
|
|
}
|
|
|
|
}
|