[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DiffusionRefsQueryConduitAPIMethod 4 extends DiffusionQueryConduitAPIMethod { 5 6 public function getAPIMethodName() { 7 return 'diffusion.refsquery'; 8 } 9 10 public function getMethodDescription() { 11 return 12 'Query a git repository for ref information at a specific commit.'; 13 } 14 15 public function defineReturnType() { 16 return 'array'; 17 } 18 19 protected function defineCustomParamTypes() { 20 return array( 21 'commit' => 'required string', 22 ); 23 } 24 25 protected function getGitResult(ConduitAPIRequest $request) { 26 $drequest = $this->getDiffusionRequest(); 27 $repository = $drequest->getRepository(); 28 $commit = $request->getValue('commit'); 29 30 list($stdout) = $repository->execxLocalCommand( 31 'log --format=%s -n 1 %s --', 32 '%d', 33 $commit); 34 35 // %d, gives a weird output format 36 // similar to (remote/one, remote/two, remote/three) 37 $refs = trim($stdout, "() \n"); 38 if (!$refs) { 39 return array(); 40 } 41 $refs = explode(',', $refs); 42 $refs = array_map('trim', $refs); 43 44 $ref_links = array(); 45 foreach ($refs as $ref) { 46 $ref_links[] = array( 47 'ref' => $ref, 48 'href' => $drequest->generateURI( 49 array( 50 'action' => 'browse', 51 'branch' => $ref, 52 )), 53 ); 54 } 55 56 return $ref_links; 57 } 58 59 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |