1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +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:
mkedia 2012-06-22 14:38:01 -07:00
parent 5daf08048b
commit 508f1b19f9

View file

@ -22,7 +22,7 @@
final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
extends ConduitAPIMethod {
const RESULT_LIMIT = 10;
const DEFAULT_LIMIT = 10;
public function getMethodDescription() {
return "Get commit identifiers for recent commits affecting a given path.";
@ -32,6 +32,7 @@ final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
return array(
'callsign' => 'required string',
'path' => 'required string',
'limit' => 'optional int',
);
}
@ -51,8 +52,13 @@ final class ConduitAPI_diffusion_getrecentcommitsbypath_Method
'path' => $request->getValue('path'),
));
$limit = nonempty(
$request->getValue('limit'),
self::DEFAULT_LIMIT
);
$history = DiffusionHistoryQuery::newFromDiffusionRequest($drequest)
->setLimit(self::RESULT_LIMIT)
->setLimit($limit)
->needDirectChanges(true)
->needChildChanges(true)
->loadHistory();