mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
differential.find
Summary: Test Plan: meta Reviewers: CC:
This commit is contained in:
parent
f07e4f2c16
commit
31abf0dfb5
3 changed files with 92 additions and 0 deletions
|
@ -66,6 +66,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_conduit_connect_Method' => 'applications/conduit/method/conduit/connect',
|
||||
'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_parsecommitmessage_Method' => 'applications/conduit/method/differential/parsecommitmessage',
|
||||
'ConduitAPI_differential_setdiffproperty_Method' => 'applications/conduit/method/differential/setdiffproperty',
|
||||
'ConduitAPI_differential_updaterevision_Method' => 'applications/conduit/method/differential/updaterevision',
|
||||
|
@ -274,6 +275,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_conduit_connect_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_creatediff_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_createrevision_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_find_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_differential_updaterevision_Method' => 'ConduitAPIMethod',
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<?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_find_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
return "Query Differential revisions which match certain criteria.";
|
||||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
$types = array(
|
||||
DifferentialRevisionListData::QUERY_OPEN_OWNED,
|
||||
DifferentialRevisionListData::QUERY_COMMITTABLE,
|
||||
DifferentialRevisionListData::QUERY_REVISION_IDS,
|
||||
DifferentialRevisionListData::QUERY_BY_PHID,
|
||||
);
|
||||
|
||||
$types = implode(', ', $types);
|
||||
|
||||
return array(
|
||||
'query' => 'required enum<'.$types.'>',
|
||||
'guids' => 'required nonempty list<phid>',
|
||||
);
|
||||
}
|
||||
|
||||
public function defineReturnType() {
|
||||
return 'nonempty list<dict>';
|
||||
}
|
||||
|
||||
public function defineErrorTypes() {
|
||||
return array(
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(ConduitAPIRequest $request) {
|
||||
$query = $request->getValue('query');
|
||||
$phids = $request->getValue('guids');
|
||||
|
||||
$revisions = id(new DifferentialRevisionListData(
|
||||
$query,
|
||||
(array)$phids))
|
||||
->loadRevisions();
|
||||
|
||||
$results = array();
|
||||
foreach ($data->getRevisions() as $revision) {
|
||||
$diff = $revision->loadActiveDiff();
|
||||
$results[] = array(
|
||||
'id' => $revision->getID(),
|
||||
'name' => $revision->getName(),
|
||||
'statusName' => DifferentialRevisionStatus::getNameForRevisionStatus(
|
||||
$revision->getStatus()),
|
||||
'sourcePath' => $diff->getSourcePath(),
|
||||
);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?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/constants/revisionstatus');
|
||||
phutil_require_module('phabricator', 'applications/differential/data/revisionlist');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ConduitAPI_differential_find_Method.php');
|
Loading…
Reference in a new issue