mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-01 15:09:14 +01:00
Summary: Fixes T2451. Several motivations here, from strongest to weakest: - Currently, getting blame and file content are closely entwined. This makes fixing T9319 more difficult, and I want to fix it. I want to separate blame from content so there's more flexibility in how we approach this issue. - This makes pursuing T2450 easier, if it turns out to be a meaningful win. - If we can get a win on blame performance, we can do `arc blame` eventually if we want. Test Plan: - Blamed in SVN, Git and Mercurial. Reviewers: chad Reviewed By: chad Maniphest Tasks: T2451 Differential Revision: https://secure.phabricator.com/D14957
44 lines
982 B
PHP
44 lines
982 B
PHP
<?php
|
|
|
|
final class DiffusionBlameConduitAPIMethod
|
|
extends DiffusionQueryConduitAPIMethod {
|
|
|
|
public function getAPIMethodName() {
|
|
return 'diffusion.blame';
|
|
}
|
|
|
|
public function getMethodDescription() {
|
|
return pht('Get blame information for a list of paths.');
|
|
}
|
|
|
|
protected function defineReturnType() {
|
|
return 'map<string, wild>';
|
|
}
|
|
|
|
protected function defineCustomParamTypes() {
|
|
return array(
|
|
'paths' => 'required list<string>',
|
|
'commit' => 'required string',
|
|
'timeout' => 'optional int',
|
|
);
|
|
}
|
|
|
|
protected function getResult(ConduitAPIRequest $request) {
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$paths = $request->getValue('paths');
|
|
|
|
$blame_query = DiffusionBlameQuery::newFromDiffusionRequest($drequest)
|
|
->setPaths($paths);
|
|
|
|
$timeout = $request->getValue('timeout');
|
|
if ($timeout) {
|
|
$blame_query->setTimeout($timeout);
|
|
}
|
|
|
|
$blame = $blame_query->execute();
|
|
|
|
return $blame;
|
|
}
|
|
|
|
}
|