Page MenuHomePhabricator

D20993.id50029.diff
No OneTemporary

D20993.id50029.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -471,7 +471,7 @@
'ArcanistVariableReferenceSpacingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistVariableReferenceSpacingXHPASTLinterRuleTestCase.php',
'ArcanistVariableVariableXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistVariableVariableXHPASTLinterRule.php',
'ArcanistVariableVariableXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistVariableVariableXHPASTLinterRuleTestCase.php',
- 'ArcanistVersionWorkflow' => 'workflow/ArcanistVersionWorkflow.php',
+ 'ArcanistVersionWorkflow' => 'toolset/workflow/ArcanistVersionWorkflow.php',
'ArcanistWeldWorkflow' => 'workflow/ArcanistWeldWorkflow.php',
'ArcanistWhichWorkflow' => 'workflow/ArcanistWhichWorkflow.php',
'ArcanistWildConfigOption' => 'config/option/ArcanistWildConfigOption.php',
diff --git a/src/runtime/ArcanistRuntime.php b/src/runtime/ArcanistRuntime.php
--- a/src/runtime/ArcanistRuntime.php
+++ b/src/runtime/ArcanistRuntime.php
@@ -168,32 +168,21 @@
// NOTE: We don't have phutil_is_windows() yet here.
$is_windows = (DIRECTORY_SEPARATOR != '/');
- // We use stream_socket_pair() which is not available on Windows earlier.
- $min_version = ($is_windows ? '5.3.0' : '5.2.3');
- $cur_version = phpversion();
- if (version_compare($cur_version, $min_version, '<')) {
- $message = sprintf(
- 'You are running a version of PHP ("%s"), which is older than the '.
- 'minimum supported version ("%s"). Update PHP to continue.',
- $cur_version,
- $min_version);
-
- throw new Exception($message);
- }
+ // NOTE: There's a hard PHP version check earlier, in "init-script.php".
if ($is_windows) {
$need_functions = array(
- 'curl_init' => array('builtin-dll', 'php_curl.dll'),
+ 'curl_init' => array('builtin-dll', 'php_curl.dll'),
);
} else {
$need_functions = array(
- 'curl_init' => array(
+ 'curl_init' => array(
'text',
"You need to install the cURL PHP extension, maybe with ".
"'apt-get install php5-curl' or 'yum install php53-curl' or ".
"something similar.",
),
- 'json_decode' => array('flag', '--without-json'),
+ 'json_decode' => array('flag', '--without-json'),
);
}
@@ -483,6 +472,7 @@
private function newWorkflows(ArcanistToolset $toolset) {
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('ArcanistWorkflow')
+ ->setContinueOnFailure(true)
->execute();
foreach ($workflows as $key => $workflow) {
diff --git a/src/toolset/workflow/ArcanistVersionWorkflow.php b/src/toolset/workflow/ArcanistVersionWorkflow.php
new file mode 100644
--- /dev/null
+++ b/src/toolset/workflow/ArcanistVersionWorkflow.php
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * Display the current version of Arcanist.
+ */
+final class ArcanistVersionWorkflow extends ArcanistWorkflow {
+
+ public function supportsToolset(ArcanistToolset $toolset) {
+ return true;
+ }
+
+ public function getWorkflowName() {
+ return 'version';
+ }
+
+ public function getWorkflowInformation() {
+ // TOOLSETS: Expand this help.
+
+ $help = pht(<<<EOTEXT
+Shows the current version.
+EOTEXT
+);
+
+ return $this->newWorkflowInformation()
+ ->addExample(pht('**version**'))
+ ->setHelp($help);
+ }
+
+ public function getWorkflowArguments() {
+ return array();
+ }
+
+ public function runWorkflow() {
+ // TOOLSETS: Show the toolset version, not just the "arc" version.
+
+ $console = PhutilConsole::getConsole();
+
+ if (!Filesystem::binaryExists('git')) {
+ throw new ArcanistUsageException(
+ pht(
+ 'Cannot display current version without "%s" installed.',
+ 'git'));
+ }
+
+ $roots = array(
+ 'arcanist' => dirname(phutil_get_library_root('arcanist')),
+ );
+
+ foreach ($roots as $lib => $root) {
+ $working_copy = ArcanistWorkingCopy::newFromWorkingDirectory($root);
+ $repository_api = $working_copy->newRepositoryAPI();
+
+ if (!$repository_api instanceof ArcanistGitAPI) {
+ throw new ArcanistUsageException(
+ pht(
+ 'Library "%s" is not a Git working copy, so no version '.
+ 'information can be provided.',
+ $lib));
+ }
+
+ // NOTE: Carefully execute these commands in a way that works on Windows
+ // until T8298 is properly fixed. See PHI52.
+
+ list($commit) = $repository_api->execxLocal('log -1 --format=%%H');
+ $commit = trim($commit);
+
+ list($timestamp) = $repository_api->execxLocal('log -1 --format=%%ct');
+ $timestamp = trim($timestamp);
+
+ $console->writeOut(
+ "%s %s (%s)\n",
+ $lib,
+ $commit,
+ date('j M Y', (int)$timestamp));
+ }
+ }
+
+}
diff --git a/src/workflow/ArcanistVersionWorkflow.php b/src/workflow/ArcanistVersionWorkflow.php
deleted file mode 100644
--- a/src/workflow/ArcanistVersionWorkflow.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/**
- * Display the current version of Arcanist.
- */
-final class ArcanistVersionWorkflow extends ArcanistWorkflow {
-
- public function getWorkflowName() {
- return 'version';
- }
-
- public function getCommandSynopses() {
- return phutil_console_format(<<<EOTEXT
- **version** [__options__]
-EOTEXT
- );
- }
-
- public function getCommandHelp() {
- return phutil_console_format(pht(<<<EOTEXT
- Supports: cli
- Shows the current version of arcanist.
-EOTEXT
- ));
- }
-
- public function run() {
- $console = PhutilConsole::getConsole();
-
- if (!Filesystem::binaryExists('git')) {
- throw new ArcanistUsageException(
- pht(
- 'Cannot display current version without having `%s` installed.',
- 'git'));
- }
-
- $roots = array(
- 'arcanist' => dirname(phutil_get_library_root('arcanist')),
- );
-
- foreach ($roots as $lib => $root) {
- $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
- $configuration_manager = clone $this->getConfigurationManager();
- $configuration_manager->setWorkingCopyIdentity($working_copy);
- $repository = ArcanistRepositoryAPI::newAPIFromConfigurationManager(
- $configuration_manager);
-
- if (!Filesystem::pathExists($repository->getMetadataPath())) {
- throw new ArcanistUsageException(
- pht('%s is not a git working copy.', $lib));
- }
-
- // NOTE: Carefully execute these commands in a way that works on Windows
- // until T8298 is properly fixed. See PHI52.
-
- list($commit) = $repository->execxLocal('log -1 --format=%%H');
- $commit = trim($commit);
-
- list($timestamp) = $repository->execxLocal('log -1 --format=%%ct');
- $timestamp = trim($timestamp);
-
- $console->writeOut(
- "%s %s (%s)\n",
- $lib,
- $commit,
- date('j M Y', (int)$timestamp));
- }
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 30, 3:22 AM (5 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706038
Default Alt Text
D20993.id50029.diff (7 KB)

Event Timeline