Changeset View
Changeset View
Standalone View
Standalone View
src/repository/marker/ArcanistRepositoryMarkerQuery.php
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if ($this->isRemoteCache !== null) { | ||||
foreach ($markers as $key => $marker) { | foreach ($markers as $key => $marker) { | ||||
$is_cache = ($marker->getRemoteName() !== null); | $is_cache = ($marker->getRemoteName() !== null); | ||||
if ($is_cache !== $want_cache) { | if ($is_cache !== $want_cache) { | ||||
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); | ||||
} | } |