Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistMarkersWorkflow.php
Show All 10 Lines | public function runWorkflow() { | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$marker_type = $this->getWorkflowMarkerType(); | $marker_type = $this->getWorkflowMarkerType(); | ||||
$markers = $api->newMarkerRefQuery() | $markers = $api->newMarkerRefQuery() | ||||
->withMarkerTypes(array($marker_type)) | ->withMarkerTypes(array($marker_type)) | ||||
->execute(); | ->execute(); | ||||
$tail_hashes = $this->getTailHashes(); | $tail_hashes = $api->getPublishedCommitHashes(); | ||||
$heads = mpull($markers, 'getCommitHash'); | $heads = mpull($markers, 'getCommitHash'); | ||||
$graph = $api->getGraph(); | $graph = $api->getGraph(); | ||||
$limit = 1000; | $limit = 1000; | ||||
$query = $graph->newQuery() | $query = $graph->newQuery() | ||||
->withHeadHashes($heads) | ->withHeadHashes($heads) | ||||
->setLimit($limit + 1); | ->setLimit($limit + 1); | ||||
if ($tail_hashes) { | if ($tail_hashes) { | ||||
$query->withTailHashes($tail_hashes); | $query->withTailHashes($tail_hashes); | ||||
} | } | ||||
$nodes = $query->execute(); | $nodes = $query->execute(); | ||||
if (count($nodes) > $limit) { | if (count($nodes) > $limit) { | ||||
// TODO: Show what we can. | // TODO: Show what we can. | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
'Found more than %s unpublished commits which are ancestors of '. | 'Found more than %s unpublished commits which are ancestors of '. | ||||
'heads.', | 'heads.', | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | final protected function hasMarkerTypeSupport($marker_type) { | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$types = $api->getSupportedMarkerTypes(); | $types = $api->getSupportedMarkerTypes(); | ||||
$types = array_fuse($types); | $types = array_fuse($types); | ||||
return isset($types[$marker_type]); | return isset($types[$marker_type]); | ||||
} | } | ||||
private function getTailHashes() { | |||||
$api = $this->getRepositoryAPI(); | |||||
return $api->getPublishedCommitHashes(); | |||||
} | |||||
private function sortSets( | private function sortSets( | ||||
ArcanistCommitGraph $graph, | ArcanistCommitGraph $graph, | ||||
array $sets, | array $sets, | ||||
array $markers) { | array $markers) { | ||||
$marker_groups = mgroup($markers, 'getCommitHash'); | $marker_groups = mgroup($markers, 'getCommitHash'); | ||||
$sets = mpull($sets, null, 'getSetID'); | $sets = mpull($sets, null, 'getSetID'); | ||||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |