Changeset View
Changeset View
Standalone View
Standalone View
src/repository/marker/ArcanistRepositoryMarkerQuery.php
| Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | final public function execute() { | ||||
| if ($this->isActive !== null) { | if ($this->isActive !== null) { | ||||
| foreach ($markers as $key => $marker) { | foreach ($markers as $key => $marker) { | ||||
| if ($marker->getIsActive() !== $this->isActive) { | if ($marker->getIsActive() !== $this->isActive) { | ||||
| unset($markers[$key]); | unset($markers[$key]); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return $this->sortMarkers($markers); | |||||
| } | |||||
| private function sortMarkers(array $markers) { | |||||
| // Sort the list in natural order. If we apply a stable sort later, | |||||
| // markers will sort in "feature1", "feature2", etc., order if they | |||||
| // don't otherwise have a unique position. | |||||
| // This can improve behavior if two branches were updated at the same | |||||
| // time, as is common when cascading rebases after changes land. | |||||
| $map = mpull($markers, 'getName'); | |||||
| natcasesort($map); | |||||
| $markers = array_select_keys($markers, array_keys($map)); | |||||
| return $markers; | return $markers; | ||||
| } | } | ||||
| final protected function shouldQueryMarkerType($marker_type) { | final protected function shouldQueryMarkerType($marker_type) { | ||||
| if ($this->markerTypes === null) { | if ($this->markerTypes === null) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return isset($this->markerTypes[$marker_type]); | return isset($this->markerTypes[$marker_type]); | ||||
| } | } | ||||
| abstract protected function newLocalRefMarkers(); | abstract protected function newLocalRefMarkers(); | ||||
| abstract protected function newRemoteRefMarkers(ArcanistRemoteRef $remote); | abstract protected function newRemoteRefMarkers(ArcanistRemoteRef $remote); | ||||
| } | } | ||||