[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/controller/ -> DiffusionCommitBranchesController.php (source)

   1  <?php
   2  
   3  final class DiffusionCommitBranchesController extends DiffusionController {
   4  
   5    public function shouldAllowPublic() {
   6      return true;
   7    }
   8  
   9    public function willProcessRequest(array $data) {
  10      $data['user'] = $this->getRequest()->getUser();
  11      $this->diffusionRequest = DiffusionRequest::newFromDictionary($data);
  12    }
  13  
  14    public function processRequest() {
  15      $request = $this->getDiffusionRequest();
  16  
  17      $branches = array();
  18      try {
  19        $branches = $this->callConduitWithDiffusionRequest(
  20          'diffusion.branchquery',
  21          array(
  22            'contains' => $request->getCommit(),
  23          ));
  24      } catch (ConduitException $ex) {
  25        if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
  26          throw $ex;
  27        }
  28      }
  29  
  30      $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
  31  
  32      $branch_links = array();
  33      foreach ($branches as $branch) {
  34        $branch_links[] = phutil_tag(
  35          'a',
  36          array(
  37            'href' => $request->generateURI(
  38              array(
  39                'action'  => 'browse',
  40                'branch'  => $branch->getShortName(),
  41              )),
  42          ),
  43          $branch->getShortName());
  44      }
  45  
  46      return id(new AphrontAjaxResponse())
  47        ->setContent($branch_links ? implode(', ', $branch_links) : 'None');
  48    }
  49  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1