mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
[easy] Add limit param to recent commits
Summary: as title Test Plan: https://phabricator.fb.com/conduit/method/diffusion.getrecentcommitsbypath/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D2838
This commit is contained in:
parent
5daf08048b
commit
508f1b19f9
1 changed files with 8 additions and 2 deletions
|
@ -22,7 +22,7 @@
|
||||||
final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
|
final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
|
||||||
extends ConduitAPIMethod {
|
extends ConduitAPIMethod {
|
||||||
|
|
||||||
const RESULT_LIMIT = 10;
|
const DEFAULT_LIMIT = 10;
|
||||||
|
|
||||||
public function getMethodDescription() {
|
public function getMethodDescription() {
|
||||||
return "Get commit identifiers for recent commits affecting a given path.";
|
return "Get commit identifiers for recent commits affecting a given path.";
|
||||||
|
@ -32,6 +32,7 @@ final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
|
||||||
return array(
|
return array(
|
||||||
'callsign' => 'required string',
|
'callsign' => 'required string',
|
||||||
'path' => 'required string',
|
'path' => 'required string',
|
||||||
|
'limit' => 'optional int',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +52,13 @@ final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
|
||||||
'path' => $request->getValue('path'),
|
'path' => $request->getValue('path'),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$limit = nonempty(
|
||||||
|
$request->getValue('limit'),
|
||||||
|
self::DEFAULT_LIMIT
|
||||||
|
);
|
||||||
|
|
||||||
$history = DiffusionHistoryQuery::newFromDiffusionRequest($drequest)
|
$history = DiffusionHistoryQuery::newFromDiffusionRequest($drequest)
|
||||||
->setLimit(self::RESULT_LIMIT)
|
->setLimit($limit)
|
||||||
->needDirectChanges(true)
|
->needDirectChanges(true)
|
||||||
->needChildChanges(true)
|
->needChildChanges(true)
|
||||||
->loadHistory();
|
->loadHistory();
|
||||||
|
|
Loading…
Reference in a new issue