Changeset View
Changeset View
Standalone View
Standalone View
src/query/ArcanistMessageRevisionHardpointQuery.php
| <?php | <?php | ||||
| final class ArcanistMessageRevisionHardpointQuery | final class ArcanistMessageRevisionHardpointQuery | ||||
| extends ArcanistWorkflowHardpointQuery { | extends ArcanistWorkflowHardpointQuery { | ||||
| public function getHardpoints() { | public function getHardpoints() { | ||||
| return array( | return array( | ||||
| ArcanistWorkingCopyStateRefPro::HARDPOINT_REVISIONREFS, | ArcanistWorkingCopyStateRef::HARDPOINT_REVISIONREFS, | ||||
| ); | ); | ||||
| } | } | ||||
| protected function canLoadRef(ArcanistRefPro $ref) { | protected function canLoadRef(ArcanistRef $ref) { | ||||
| return ($ref instanceof ArcanistWorkingCopyStateRefPro); | return ($ref instanceof ArcanistWorkingCopyStateRef); | ||||
| } | } | ||||
| public function loadHardpoint(array $refs, $hardpoint) { | public function loadHardpoint(array $refs, $hardpoint) { | ||||
| yield $this->yieldRequests( | yield $this->yieldRequests( | ||||
| $refs, | $refs, | ||||
| array( | array( | ||||
| ArcanistWorkingCopyStateRefPro::HARDPOINT_COMMITREF, | ArcanistWorkingCopyStateRef::HARDPOINT_COMMITREF, | ||||
| )); | )); | ||||
| $commit_refs = array(); | $commit_refs = array(); | ||||
| foreach ($refs as $ref) { | foreach ($refs as $ref) { | ||||
| $commit_refs[] = $ref->getCommitRef(); | $commit_refs[] = $ref->getCommitRef(); | ||||
| } | } | ||||
| yield $this->yieldRequests( | yield $this->yieldRequests( | ||||
| $commit_refs, | $commit_refs, | ||||
| array( | array( | ||||
| ArcanistCommitRefPro::HARDPOINT_MESSAGE, | ArcanistCommitRef::HARDPOINT_MESSAGE, | ||||
| )); | )); | ||||
| $map = array(); | $map = array(); | ||||
| foreach ($refs as $ref_key => $ref) { | foreach ($refs as $ref_key => $ref) { | ||||
| $commit_ref = $ref->getCommitRef(); | $commit_ref = $ref->getCommitRef(); | ||||
| $corpus = $commit_ref->getMessage(); | $corpus = $commit_ref->getMessage(); | ||||
| $id = null; | $id = null; | ||||
| Show All 15 Lines | public function loadHardpoint(array $refs, $hardpoint) { | ||||
| if ($map) { | if ($map) { | ||||
| $revisions = (yield $this->yieldConduit( | $revisions = (yield $this->yieldConduit( | ||||
| 'differential.query', | 'differential.query', | ||||
| array( | array( | ||||
| 'ids' => array_keys($map), | 'ids' => array_keys($map), | ||||
| ))); | ))); | ||||
| foreach ($revisions as $dict) { | foreach ($revisions as $dict) { | ||||
| $revision_ref = ArcanistRevisionRefPro::newFromConduit($dict); | $revision_ref = ArcanistRevisionRef::newFromConduit($dict); | ||||
| $id = $dict['id']; | $id = $dict['id']; | ||||
| $state_refs = idx($map, $id, array()); | $state_refs = idx($map, $id, array()); | ||||
| foreach ($state_refs as $ref_key => $state_ref) { | foreach ($state_refs as $ref_key => $state_ref) { | ||||
| $results[$ref_key][] = $revision_ref; | $results[$ref_key][] = $revision_ref; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| yield $this->yieldMap($results); | yield $this->yieldMap($results); | ||||
| } | } | ||||
| } | } | ||||