1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-08 16:02:39 +01:00
phorge-arcanist/src/workflow/ArcanistBookmarksWorkflow.php
epriestley 599ba0f999 Provide a more powerful query mechanism for "markers" (branches/bookmarks)
Summary:
Ref T13546. Various Arcanist workflows, and particularly the MercurialAPI, currently repeat quite a lot of code around parsing branches and bookmarks.

In modern Mercurial, we can generally use the "head()" and "bookmark()" revsets to do this fairly sensibly.

This change mostly adds //more// code (and introduces "arc bookmarks" and "arc branches" as replacements for "arc bookmark" and "arc branch") but followups should be able to mostly delete code.

Test Plan: Ran "arc branches" and "arc bookmarks" in Git and Mercurial.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21333
2020-06-08 16:27:20 -07:00

43 lines
1 KiB
PHP

<?php
final class ArcanistBookmarksWorkflow
extends ArcanistMarkersWorkflow {
public function getWorkflowName() {
return 'bookmarks';
}
public function getWorkflowArguments() {
return array();
}
public function getWorkflowInformation() {
$help = pht(<<<EOHELP
Lists bookmarks in the working copy, annotated with additional information
about review status.
EOHELP
);
return $this->newWorkflowInformation()
->setSynopsis(
pht('Show an enhanced view of bookmarks in the working copy.'))
->addExample(pht('**bookmarks**'))
->setHelp($help);
}
protected function getWorkflowMarkerType() {
$api = $this->getRepositoryAPI();
$marker_type = ArcanistMarkerRef::TYPE_BOOKMARK;
if (!$this->hasMarkerTypeSupport($marker_type)) {
throw new PhutilArgumentUsageException(
pht(
'The version control system ("%s") in the current working copy '.
'does not support bookmarks.',
$api->getSourceControlSystemName()));
}
return $marker_type;
}
}