3 final class DiffusionRefTableController
extends DiffusionController
{
5 public function shouldAllowPublic() {
9 public function handleRequest(AphrontRequest
$request) {
10 $response = $this->loadDiffusionContext();
15 $viewer = $this->getViewer();
16 $drequest = $this->getDiffusionRequest();
17 $repository = $drequest->getRepository();
19 if (!$drequest->supportsBranches()) {
20 return $this->newDialog()
21 ->setTitle(pht('No Ref Support'))
24 'The version control system this repository uses does not '.
25 'support named references, so you can not resolve or list '.
26 'repository refs in this repository.'))
27 ->addCancelButton($repository->getURI());
30 $ref_name = $drequest->getBranch();
32 $cache_query = id(new DiffusionCachedResolveRefsQuery())
33 ->setRepository($repository);
34 if ($ref_name !== null) {
35 $cache_query->withRefs(array($ref_name));
37 $cache_refs = $cache_query->execute();
39 $vcs_refs = DiffusionQuery
::callConduitWithDiffusionRequest(
42 'diffusion.resolverefs',
44 'refs' => array($ref_name),
48 foreach ($cache_refs as $ref => $results) {
49 foreach ($results as $result) {
50 $id = $result['type'].'/'.$result['identifier'];
51 $all[$ref][$id]['cache'] = $result;
55 foreach ($vcs_refs as $ref => $results) {
56 foreach ($results as $result) {
57 $id = $result['type'].'/'.$result['identifier'];
58 $all[$ref][$id]['vcs'] = $result;
63 foreach ($all as $ref => $results) {
64 foreach ($results as $info) {
65 $cache = idx($info, 'cache', array());
66 $vcs = idx($info, 'vcs', array());
68 $type = idx($vcs, 'type');
70 $type = idx($cache, 'type');
73 $hash = idx($vcs, 'identifier');
75 $hash = DiffusionView
::linkCommit(
80 $cached_hash = idx($cache, 'identifier');
81 if ($cached_hash !== null) {
82 $cached_hash = DiffusionView
::linkCommit(
87 $closed = idx($vcs, 'closed', false);
91 $state = $closed ?
pht('Closed') : pht('Open');
94 $cached_closed = idx($cache, 'closed', false);
98 $cached_state = $cached_closed ?
pht('Closed') : pht('Open');
101 $alternate = idx($vcs, 'alternate');
102 if ($alternate !== null) {
103 $alternate = DiffusionView
::linkCommit(
120 $table = id(new AphrontTableView($rows))
132 $content = id(new PHUIObjectBoxView())
133 ->setHeaderText(pht('Ref "%s"', $ref_name))
136 $crumbs = $this->buildCrumbs(array());
137 $crumbs->addTextCrumb(pht('Refs'));
139 return $this->newPage()
144 $repository->getDisplayName(),
147 ->appendChild($content);