mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
36e2d02d6e
Summary: `pht`ize a whole bunch of strings in rP. Test Plan: Intense eyeballing. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12797
66 lines
1.7 KiB
PHP
66 lines
1.7 KiB
PHP
<?php
|
|
|
|
final class DiffusionGetRecentCommitsByPathConduitAPIMethod
|
|
extends DiffusionConduitAPIMethod {
|
|
|
|
const DEFAULT_LIMIT = 10;
|
|
|
|
public function getAPIMethodName() {
|
|
return 'diffusion.getrecentcommitsbypath';
|
|
}
|
|
|
|
public function getMethodDescription() {
|
|
return pht(
|
|
'Get commit identifiers for recent commits affecting a given path.');
|
|
}
|
|
|
|
protected function defineParamTypes() {
|
|
return array(
|
|
'callsign' => 'required string',
|
|
'path' => 'required string',
|
|
'branch' => 'optional string',
|
|
'limit' => 'optional int',
|
|
);
|
|
}
|
|
|
|
protected function defineReturnType() {
|
|
return 'nonempty list<string>';
|
|
}
|
|
|
|
protected function execute(ConduitAPIRequest $request) {
|
|
$drequest = DiffusionRequest::newFromDictionary(
|
|
array(
|
|
'user' => $request->getUser(),
|
|
'callsign' => $request->getValue('callsign'),
|
|
'path' => $request->getValue('path'),
|
|
'branch' => $request->getValue('branch'),
|
|
));
|
|
|
|
$limit = nonempty(
|
|
$request->getValue('limit'),
|
|
self::DEFAULT_LIMIT);
|
|
|
|
$history_result = DiffusionQuery::callConduitWithDiffusionRequest(
|
|
$request->getUser(),
|
|
$drequest,
|
|
'diffusion.historyquery',
|
|
array(
|
|
'commit' => $drequest->getCommit(),
|
|
'path' => $drequest->getPath(),
|
|
'offset' => 0,
|
|
'limit' => $limit,
|
|
'needDirectChanges' => true,
|
|
'needChildChanges' => true,
|
|
));
|
|
$history = DiffusionPathChange::newFromConduit(
|
|
$history_result['pathChanges']);
|
|
|
|
$raw_commit_identifiers = mpull($history, 'getCommitIdentifier');
|
|
$result = array();
|
|
foreach ($raw_commit_identifiers as $id) {
|
|
$result[] = 'r'.$request->getValue('callsign').$id;
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
}
|