4
* Display the current version of Arcanist.
6
final class ArcanistVersionWorkflow extends ArcanistWorkflow {
8
public function getWorkflowName() {
12
public function getCommandSynopses() {
13
return phutil_console_format(<<<EOTEXT
14
**version** [__options__]
19
public function getCommandHelp() {
20
return phutil_console_format(pht(<<<EOTEXT
22
Shows the current version of arcanist.
27
public function run() {
28
$console = PhutilConsole::getConsole();
30
if (!Filesystem::binaryExists('git')) {
31
throw new ArcanistUsageException(
32
'Cannot display current version without having `git` installed.');
36
'arcanist' => dirname(phutil_get_library_root('arcanist')),
37
'libphutil' => dirname(phutil_get_library_root('phutil')),
40
foreach ($roots as $lib => $root) {
41
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
42
$configuration_manager = clone $this->getConfigurationManager();
43
$configuration_manager->setWorkingCopyIdentity($working_copy);
44
$repository = ArcanistRepositoryAPI::newAPIFromConfigurationManager(
45
$configuration_manager);
47
if (!Filesystem::pathExists($repository->getMetadataPath())) {
48
throw new ArcanistUsageException("{$lib} is not a git working copy.");
51
list($stdout) = $repository->execxLocal('log -1 --format=%s', '%H %ct');
52
list($commit, $timestamp) = explode(' ', $stdout);
54
$console->writeOut("%s %s (%s)\n",
57
date('j M Y', (int)$timestamp));