[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DiffusionGetRecentCommitsByPathConduitAPIMethod 4 extends DiffusionConduitAPIMethod { 5 6 const DEFAULT_LIMIT = 10; 7 8 public function getAPIMethodName() { 9 return 'diffusion.getrecentcommitsbypath'; 10 } 11 12 public function getMethodDescription() { 13 return 'Get commit identifiers for recent commits affecting a given path.'; 14 } 15 16 public function defineParamTypes() { 17 return array( 18 'callsign' => 'required string', 19 'path' => 'required string', 20 'branch' => 'optional string', 21 'limit' => 'optional int', 22 ); 23 } 24 25 public function defineReturnType() { 26 return 'nonempty list<string>'; 27 } 28 29 public function defineErrorTypes() { 30 return array( 31 ); 32 } 33 34 protected function execute(ConduitAPIRequest $request) { 35 $drequest = DiffusionRequest::newFromDictionary( 36 array( 37 'user' => $request->getUser(), 38 'callsign' => $request->getValue('callsign'), 39 'path' => $request->getValue('path'), 40 'branch' => $request->getValue('branch'), 41 )); 42 43 $limit = nonempty( 44 $request->getValue('limit'), 45 self::DEFAULT_LIMIT); 46 47 $history_result = DiffusionQuery::callConduitWithDiffusionRequest( 48 $request->getUser(), 49 $drequest, 50 'diffusion.historyquery', 51 array( 52 'commit' => $drequest->getCommit(), 53 'path' => $drequest->getPath(), 54 'offset' => 0, 55 'limit' => $limit, 56 'needDirectChanges' => true, 57 'needChildChanges' => true, 58 )); 59 $history = DiffusionPathChange::newFromConduit( 60 $history_result['pathChanges']); 61 62 $raw_commit_identifiers = mpull($history, 'getCommitIdentifier'); 63 $result = array(); 64 foreach ($raw_commit_identifiers as $id) { 65 $result[] = 'r'.$request->getValue('callsign').$id; 66 } 67 return $result; 68 } 69 70 }
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 |