1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Allow "loadHardpoints()" to accept a single ref and/or a single hardpoint

Summary: Ref T13490. There's more `array(...)` happening in this API than necessary. Sugar it slightly.

Test Plan: Grepped for "loadHardpoints()", ran a couple workflows.

Maniphest Tasks: T13490

Differential Revision: https://secure.phabricator.com/D21088
This commit is contained in:
epriestley 2020-04-11 15:30:43 -07:00
parent 6e24e10bdb
commit 73f48aca74
5 changed files with 15 additions and 18 deletions

View file

@ -120,9 +120,7 @@ EOTEXT
$this->loadHardpoints(
$refs,
array(
ArcanistBrowseRef::HARDPOINT_URIS,
));
ArcanistBrowseRef::HARDPOINT_URIS);
$zero_hits = array();
$open_uris = array();

View file

@ -3062,12 +3062,8 @@ EOTEXT
->setCommitRef($base_ref);
$this->loadHardpoints(
array(
$state_ref,
),
array(
ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS,
));
ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS);
$revision_refs = $state_ref->getRevisionRefs();
$viewer_phid = $this->getUserPHID();

View file

@ -79,10 +79,7 @@ EOHELP
$this->loadHardpoints(
ipull($states, 'state'),
array(
ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS,
));
ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS);
$this->printBranches($states);

View file

@ -98,9 +98,7 @@ EOTEXT
if ($hardpoints) {
$hardpoint_keys = mpull($hardpoints, 'getHardpointKey');
$this->loadHardpoints(
$refs,
$hardpoint_keys);
$this->loadHardpoints($refs, $hardpoint_keys);
}
}
}

View file

@ -2299,8 +2299,16 @@ abstract class ArcanistWorkflow extends Phobject {
}
final protected function loadHardpoints(
array $objects,
array $requests) {
$objects,
$requests) {
if (!is_array($objects)) {
$objects = array($objects);
}
if (!is_array($requests)) {
$requests = array($requests);
}
$engine = $this->getHardpointEngine();