@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 DiffusionRawDiffQueryConduitAPIMethod
4 extends DiffusionQueryConduitAPIMethod {
5
6 public function getAPIMethodName() {
7 return 'diffusion.rawdiffquery';
8 }
9
10 public function getMethodDescription() {
11 return pht(
12 'Get raw diff information from a repository for a specific commit at an '.
13 '(optional) path.');
14 }
15
16 protected function defineReturnType() {
17 return 'string';
18 }
19
20 protected function defineCustomParamTypes() {
21 return array(
22 'commit' => 'required string',
23 'path' => 'optional string',
24 'linesOfContext' => 'optional int',
25 'againstCommit' => 'optional string',
26 ) + DiffusionFileFutureQuery::getConduitParameters();
27 }
28
29 protected function getResult(ConduitAPIRequest $request) {
30 $drequest = $this->getDiffusionRequest();
31
32 $query = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest);
33
34 $lines_of_context = $request->getValue('linesOfContext');
35 if ($lines_of_context !== null) {
36 $query->setLinesOfContext($lines_of_context);
37 }
38
39 $against_commit = $request->getValue('againstCommit');
40 if ($against_commit !== null) {
41 $query->setAgainstCommit($against_commit);
42 }
43
44 return $query->respondToConduitRequest($request);
45 }
46
47}