mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-21 11:09:02 +01:00
Summary: Fixes T10423. Ref T11524. This changes `diffusion.rawdiffquery` to return a file PHID instead of a blob of data. This is better in general, but particularly better for huge diffs (as in T10423) and diffs with non-utf8 data (as in T10423). Test Plan: - Used `bin/differential extract` to extract a latin1 diff, got a clean diff. - Used `bin/repository reparse --herald` to rerun herald on a latin1 diff, got a clean result. - Pushed latin1 diffs to test commit hooks. - Triggered the the too large / too slow logic. - Viewed latin1 diffs in Diffusion. - Used "blame past this change" in Diffusion to hit the `before` logic. Reviewers: chad Reviewed By: chad Subscribers: eadler Maniphest Tasks: T10423, T11524 Differential Revision: https://secure.phabricator.com/D16460
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class DiffusionRawDiffQueryConduitAPIMethod
|
|
extends DiffusionQueryConduitAPIMethod {
|
|
|
|
public function getAPIMethodName() {
|
|
return 'diffusion.rawdiffquery';
|
|
}
|
|
|
|
public function getMethodDescription() {
|
|
return pht(
|
|
'Get raw diff information from a repository for a specific commit at an '.
|
|
'(optional) path.');
|
|
}
|
|
|
|
protected function defineReturnType() {
|
|
return 'string';
|
|
}
|
|
|
|
protected function defineCustomParamTypes() {
|
|
return array(
|
|
'commit' => 'required string',
|
|
'path' => 'optional string',
|
|
'linesOfContext' => 'optional int',
|
|
'againstCommit' => 'optional string',
|
|
) + DiffusionFileFutureQuery::getConduitParameters();
|
|
}
|
|
|
|
protected function getResult(ConduitAPIRequest $request) {
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$query = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest);
|
|
|
|
$lines_of_context = $request->getValue('linesOfContext');
|
|
if ($lines_of_context !== null) {
|
|
$query->setLinesOfContext($lines_of_context);
|
|
}
|
|
|
|
$against_commit = $request->getValue('againstCommit');
|
|
if ($against_commit !== null) {
|
|
$query->setAgainstCommit($against_commit);
|
|
}
|
|
|
|
return $query->respondToConduitRequest($request);
|
|
}
|
|
|
|
}
|