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();
|
2012-08-01 01:27:48 +02:00
|
|
|
|
2013-05-21 02:04:51 +02:00
|
|
|
$branches = array();
|
|
|
|
try {
|
|
|
|
$branches = $this->callConduitWithDiffusionRequest(
|
2014-01-18 01:11:04 +01:00
|
|
|
'diffusion.branchquery',
|
|
|
|
array(
|
2015-01-09 22:29:08 +01:00
|
|
|
'contains' => $drequest->getCommit(),
|
2014-01-18 01:11:04 +01:00
|
|
|
));
|
2013-05-21 02:04:51 +02:00
|
|
|
} catch (ConduitException $ex) {
|
|
|
|
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
|
|
|
throw $ex;
|
|
|
|
}
|
|
|
|
}
|
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');
|
|
|
|
}
|
|
|
|
}
|