mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
Remove support for "paths" parameter in "differential.query"
Summary: See T13639. This change simplifies providing a more modern approach to querying this data via "differential.revision.search". Test Plan: Called "differential.query" with paths (got an error) and without paths (got a valid query result). Differential Revision: https://secure.phabricator.com/D21613
This commit is contained in:
parent
e730f55e88
commit
bcd592cf7e
1 changed files with 6 additions and 43 deletions
|
@ -38,7 +38,7 @@ final class DifferentialQueryConduitAPIMethod
|
||||||
'authors' => 'optional list<phid>',
|
'authors' => 'optional list<phid>',
|
||||||
'ccs' => 'optional list<phid>',
|
'ccs' => 'optional list<phid>',
|
||||||
'reviewers' => 'optional list<phid>',
|
'reviewers' => 'optional list<phid>',
|
||||||
'paths' => 'optional list<pair<callsign, path>>',
|
'paths' => 'unsupported',
|
||||||
'commitHashes' => 'optional list<pair<'.$hash_const.', string>>',
|
'commitHashes' => 'optional list<pair<'.$hash_const.', string>>',
|
||||||
'status' => 'optional '.$status_const,
|
'status' => 'optional '.$status_const,
|
||||||
'order' => 'optional '.$order_const,
|
'order' => 'optional '.$order_const,
|
||||||
|
@ -92,48 +92,11 @@ final class DifferentialQueryConduitAPIMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path_pairs) {
|
if ($path_pairs) {
|
||||||
$paths = array();
|
throw new Exception(
|
||||||
foreach ($path_pairs as $pair) {
|
pht(
|
||||||
list($callsign, $path) = $pair;
|
'Parameter "paths" to Conduit API method "differential.query" is '.
|
||||||
$paths[] = $path;
|
'no longer supported. Use the "paths" constraint to '.
|
||||||
}
|
'"differential.revision.search" instead. See T13639.'));
|
||||||
|
|
||||||
$path_map = id(new DiffusionPathIDQuery($paths))->loadPathIDs();
|
|
||||||
if (count($path_map) != count($paths)) {
|
|
||||||
$unknown_paths = array();
|
|
||||||
foreach ($paths as $p) {
|
|
||||||
if (!idx($path_map, $p)) {
|
|
||||||
$unknown_paths[] = $p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
|
|
||||||
->setErrorDescription(
|
|
||||||
pht(
|
|
||||||
'Unknown paths: %s',
|
|
||||||
implode(', ', $unknown_paths)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$repos = array();
|
|
||||||
foreach ($path_pairs as $pair) {
|
|
||||||
list($callsign, $path) = $pair;
|
|
||||||
if (!idx($repos, $callsign)) {
|
|
||||||
$repos[$callsign] = id(new PhabricatorRepositoryQuery())
|
|
||||||
->setViewer($request->getUser())
|
|
||||||
->withCallsigns(array($callsign))
|
|
||||||
->executeOne();
|
|
||||||
|
|
||||||
if (!$repos[$callsign]) {
|
|
||||||
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
|
|
||||||
->setErrorDescription(
|
|
||||||
pht(
|
|
||||||
'Unknown repo callsign: %s',
|
|
||||||
$callsign));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$repo = $repos[$callsign];
|
|
||||||
|
|
||||||
$query->withPath($repo->getID(), idx($path_map, $path));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($commit_hashes) {
|
if ($commit_hashes) {
|
||||||
|
|
Loading…
Reference in a new issue