mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Added a conduit method for getting all the diffs for a revision.
Summary: Loading all diffs for a differential revision is needed by at least perflab. Test Plan: Created a simple script that queried the conduit and made sure that it returned correct values. Reviewed By: jungejason Reviewers: jungejason CC: epriestley, jungejason Differential Revision: 155
This commit is contained in:
parent
a6c770217d
commit
6baeda8aad
3 changed files with 77 additions and 0 deletions
|
@ -78,6 +78,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_differential_creatediff_Method' => 'applications/conduit/method/differential/creatediff',
|
||||
'ConduitAPI_differential_createrevision_Method' => 'applications/conduit/method/differential/createrevision',
|
||||
'ConduitAPI_differential_find_Method' => 'applications/conduit/method/differential/find',
|
||||
'ConduitAPI_differential_getalldiffs_Method' => 'applications/conduit/method/differential/getalldiffs',
|
||||
'ConduitAPI_differential_getcommitmessage_Method' => 'applications/conduit/method/differential/getcommitmessage',
|
||||
'ConduitAPI_differential_getcommitpaths_Method' => 'applications/conduit/method/differential/getcommitpaths',
|
||||
'ConduitAPI_differential_getdiff_Method' => 'applications/conduit/method/differential/getdiff',
|
||||
|
@ -525,6 +526,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_differential_creatediff_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_createrevision_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_find_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_getalldiffs_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_getcommitmessage_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_getcommitpaths_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_getdiff_Method' => 'ConduitAPIMethod',
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class ConduitAPI_differential_getalldiffs_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
return "Load all diffs for given revisions from Differential.";
|
||||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
return array(
|
||||
'revision_ids' => 'required list<int>',
|
||||
);
|
||||
}
|
||||
|
||||
public function defineReturnType() {
|
||||
return 'dict';
|
||||
}
|
||||
|
||||
public function defineErrorTypes() {
|
||||
return array();
|
||||
}
|
||||
|
||||
protected function execute(ConduitAPIRequest $request) {
|
||||
$results = array();
|
||||
$revision_ids = $request->getValue('revision_ids');
|
||||
|
||||
if (!$revision_ids) {
|
||||
return $results;
|
||||
}
|
||||
|
||||
$diffs = id(new DifferentialDiff())->loadAllWhere(
|
||||
'revisionID IN (%Ld)',
|
||||
$revision_ids);
|
||||
|
||||
foreach ($diffs as $diff) {
|
||||
$results[] = array(
|
||||
'revision_id' => $diff->getRevisionID(),
|
||||
'diff_id' => $diff->getID(),
|
||||
);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/conduit/method/base');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/diff');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ConduitAPI_differential_getalldiffs_Method.php');
|
Loading…
Reference in a new issue