Changeset View
Changeset View
Standalone View
Standalone View
src/repository/marker/ArcanistMercurialRepositoryMarkerQuery.php
| Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | private function newMarkers(ArcanistRemoteRef $remote = null) { | ||||
| $markers = array(); | $markers = array(); | ||||
| foreach ($items as $item) { | foreach ($items as $item) { | ||||
| if (!empty($item['isClosed'])) { | if (!empty($item['isClosed'])) { | ||||
| // NOTE: For now, we ignore closed branch heads. | // NOTE: For now, we ignore closed branch heads. | ||||
| continue; | continue; | ||||
| } | } | ||||
| $node = $item['node']; | $node = $item['node']; | ||||
| if (!$node) { | |||||
| // NOTE: For now, we ignore the virtual "current branch" marker. | |||||
| continue; | |||||
| } | |||||
| switch ($item['type']) { | switch ($item['type']) { | ||||
| case 'branch': | case 'branch': | ||||
| $marker_type = ArcanistMarkerRef::TYPE_BRANCH; | $marker_type = ArcanistMarkerRef::TYPE_BRANCH; | ||||
| break; | break; | ||||
| case 'bookmark': | case 'bookmark': | ||||
| $marker_type = ArcanistMarkerRef::TYPE_BOOKMARK; | $marker_type = ArcanistMarkerRef::TYPE_BOOKMARK; | ||||
| break; | break; | ||||
| case 'commit': | case 'commit-state': | ||||
| $marker_type = null; | $marker_type = ArcanistMarkerRef::TYPE_COMMIT_STATE; | ||||
| break; | |||||
| case 'branch-state': | |||||
| $marker_type = ArcanistMarkerRef::TYPE_BRANCH_STATE; | |||||
| break; | break; | ||||
| default: | default: | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Call to "hg arc-ls-markers" returned marker of unknown '. | 'Call to "hg arc-ls-markers" returned marker of unknown '. | ||||
| 'type "%s".', | 'type "%s".', | ||||
| $item['type'])); | $item['type'])); | ||||
| } | } | ||||
| if ($marker_type === null) { | |||||
| // NOTE: For now, we ignore the virtual "head" marker. | |||||
| continue; | |||||
| } | |||||
| $commit_ref = $api->newCommitRef() | $commit_ref = $api->newCommitRef() | ||||
| ->setCommitHash($node); | ->setCommitHash($node); | ||||
| $marker_ref = id(new ArcanistMarkerRef()) | $marker_ref = id(new ArcanistMarkerRef()) | ||||
| ->setName($item['name']) | ->setName($item['name']) | ||||
| ->setCommitHash($node) | ->setCommitHash($node) | ||||
| ->attachCommitRef($commit_ref); | ->attachCommitRef($commit_ref); | ||||
| Show All 19 Lines | |||||