1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +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( $this->loadHardpoints(
$refs, $refs,
array( ArcanistBrowseRef::HARDPOINT_URIS);
ArcanistBrowseRef::HARDPOINT_URIS,
));
$zero_hits = array(); $zero_hits = array();
$open_uris = array(); $open_uris = array();

View file

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

View file

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

View file

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

View file

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