mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-27 07:50:57 +01:00
5d495ebbad
Summary: Ref T2784. Also sneaks in a fix for branch query -- forgot to catch the unsupported VCS exception. One strange thing is I have test Phabricator repositories and the mercurial one is showing different data than git for the same commit. The data shown is consistent pre and post this diff though so its an existing issue. Also note the mercurial is an import of git so maybe its busted-ish? Test Plan: viewed commits in mercurial, svn, and git that were merge commits. saw the right stuff in mercurial and git. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2784 Differential Revision: https://secure.phabricator.com/D5985
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
final class DiffusionCommitBranchesController extends DiffusionController {
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$data['user'] = $this->getRequest()->getUser();
|
|
$this->diffusionRequest = DiffusionRequest::newFromDictionary($data);
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getDiffusionRequest();
|
|
|
|
$branches = array();
|
|
try {
|
|
$branches = $this->callConduitWithDiffusionRequest(
|
|
'diffusion.commitbranchesquery',
|
|
array('commit' => $request->getCommit()));
|
|
} catch (ConduitException $ex) {
|
|
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
|
throw $ex;
|
|
}
|
|
}
|
|
|
|
$branch_links = array();
|
|
foreach ($branches as $branch => $commit) {
|
|
$branch_links[] = phutil_tag(
|
|
'a',
|
|
array(
|
|
'href' => $request->generateURI(
|
|
array(
|
|
'action' => 'browse',
|
|
'branch' => $branch,
|
|
)),
|
|
),
|
|
$branch);
|
|
}
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
->setContent($branch_links ? implode(', ', $branch_links) : 'None');
|
|
}
|
|
}
|