@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 51 lines 1.1 kB view raw
1<?php 2 3final class DiffusionInternalAncestorsConduitAPIMethod 4 extends DiffusionQueryConduitAPIMethod { 5 6 public function isInternalAPI() { 7 return true; 8 } 9 10 public function getAPIMethodName() { 11 return 'diffusion.internal.ancestors'; 12 } 13 14 public function getMethodDescription() { 15 return pht('Internal method for filtering ref ancestors.'); 16 } 17 18 protected function defineReturnType() { 19 return 'list<string>'; 20 } 21 22 protected function defineCustomParamTypes() { 23 return array( 24 'ref' => 'required string', 25 'commits' => 'required list<string>', 26 ); 27 } 28 29 protected function getResult(ConduitAPIRequest $request) { 30 $drequest = $this->getDiffusionRequest(); 31 $repository = $drequest->getRepository(); 32 33 $commits = $request->getValue('commits'); 34 $ref = $request->getValue('ref'); 35 36 $graph = new PhabricatorGitGraphStream($repository, $ref); 37 38 $keep = array(); 39 foreach ($commits as $identifier) { 40 try { 41 $graph->getCommitDate($identifier); 42 $keep[] = $identifier; 43 } catch (Exception $ex) { 44 // Not an ancestor. 45 } 46 } 47 48 return $keep; 49 } 50 51}