Changeset View
Changeset View
Standalone View
Standalone View
src/query/ArcanistGitWorkingCopyRevisionHardpointQuery.php
| <?php | <?php | ||||
| final class ArcanistGitWorkingCopyRevisionHardpointQuery | final class ArcanistGitWorkingCopyRevisionHardpointQuery | ||||
| extends ArcanistWorkflowGitHardpointQuery { | extends ArcanistWorkflowGitHardpointQuery { | ||||
| 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, | ||||
| )); | )); | ||||
| $hashes = array(); | $hashes = array(); | ||||
| $map = array(); | $map = array(); | ||||
| foreach ($refs as $ref_key => $ref) { | foreach ($refs as $ref_key => $ref) { | ||||
| $commit = $ref->getCommitRef(); | $commit = $ref->getCommitRef(); | ||||
| $commit_hashes = array(); | $commit_hashes = array(); | ||||
| Show All 26 Lines | if ($hashes) { | ||||
| ))); | ))); | ||||
| foreach ($revisions as $dict) { | foreach ($revisions as $dict) { | ||||
| $revision_hashes = idx($dict, 'hashes'); | $revision_hashes = idx($dict, 'hashes'); | ||||
| if (!$revision_hashes) { | if (!$revision_hashes) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $revision_ref = ArcanistRevisionRefPro::newFromConduit($dict); | $revision_ref = ArcanistRevisionRef::newFromConduit($dict); | ||||
| foreach ($revision_hashes as $revision_hash) { | foreach ($revision_hashes as $revision_hash) { | ||||
| $hash_key = $this->getHashKey($revision_hash); | $hash_key = $this->getHashKey($revision_hash); | ||||
| $state_refs = idx($map, $hash_key, array()); | $state_refs = idx($map, $hash_key, 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; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Show All 10 Lines | |||||