@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
1<?php
2
3final class DiffusionBlameConduitAPIMethod
4 extends DiffusionQueryConduitAPIMethod {
5
6 public function getAPIMethodName() {
7 return 'diffusion.blame';
8 }
9
10 public function getMethodDescription() {
11 return pht('Get blame information for a list of paths.');
12 }
13
14 protected function defineReturnType() {
15 return 'map<string, wild>';
16 }
17
18 protected function defineCustomParamTypes() {
19 return array(
20 'paths' => 'required list<string>',
21 'commit' => 'required string',
22 'timeout' => 'optional int',
23 );
24 }
25
26 protected function getResult(ConduitAPIRequest $request) {
27 $drequest = $this->getDiffusionRequest();
28
29 $paths = $request->getValue('paths');
30
31 $blame_query = DiffusionBlameQuery::newFromDiffusionRequest($drequest)
32 ->setPaths($paths);
33
34 $timeout = $request->getValue('timeout');
35 if ($timeout) {
36 $blame_query->setTimeout($timeout);
37 }
38
39 $blame = $blame_query->execute();
40
41 return $blame;
42 }
43
44}