Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14902595
D9442.id22969.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D9442.id22969.diff
View Options
diff --git a/scripts/arcanist.php b/scripts/arcanist.php
--- a/scripts/arcanist.php
+++ b/scripts/arcanist.php
@@ -8,9 +8,9 @@
ini_set('memory_limit', -1);
$original_argv = $argv;
-$args = new PhutilArgumentParser($argv);
-$args->parseStandardArguments();
-$args->parsePartial(
+$base_args = new PhutilArgumentParser($argv);
+$base_args->parseStandardArguments();
+$base_args->parsePartial(
array(
array(
'name' => 'load-phutil-library',
@@ -40,20 +40,26 @@
'param' => 'timeout',
'help' => 'Set Conduit timeout (in seconds).',
),
- ));
-
-$config_trace_mode = $args->getArg('trace');
+ array(
+ 'name' => 'config',
+ 'param' => 'key=value',
+ 'repeat' => true,
+ 'help' =>
+ 'Specify a runtime configuration value. This will take precedence '.
+ 'over static values, and only affect the current arcanist invokation'
+ ),
+));
-$force_conduit = $args->getArg('conduit-uri');
-$force_conduit_version = $args->getArg('conduit-version');
-$conduit_timeout = $args->getArg('conduit-timeout');
-$skip_arcconfig = $args->getArg('skip-arcconfig');
-$custom_arcrc = $args->getArg('arcrc-file');
-$load = $args->getArg('load-phutil-library');
-$help = $args->getArg('help');
+$config_trace_mode = $base_args->getArg('trace');
-$argv = $args->getUnconsumedArgumentVector();
-$args = array_values($argv);
+$force_conduit = $base_args->getArg('conduit-uri');
+$force_conduit_version = $base_args->getArg('conduit-version');
+$conduit_timeout = $base_args->getArg('conduit-timeout');
+$skip_arcconfig = $base_args->getArg('skip-arcconfig');
+$custom_arcrc = $base_args->getArg('arcrc-file');
+$load = $base_args->getArg('load-phutil-library');
+$help = $base_args->getArg('help');
+$args = array_values($base_args->getUnconsumedArgumentVector());
$working_directory = getcwd();
$console = PhutilConsole::getConsole();
@@ -86,6 +92,8 @@
$global_config = $configuration_manager->readUserArcConfig();
$system_config = $configuration_manager->readSystemArcConfig();
+ $runtime_config = $configuration_manager->applyRuntimeArcConfig($base_args);
+
if ($skip_arcconfig) {
$working_copy = ArcanistWorkingCopyIdentity::newDummyWorkingCopy();
} else {
@@ -142,6 +150,14 @@
$must_load = true,
$lib_source = 'the "load" setting in ".arcconfig"',
$working_copy);
+
+ // Load libraries in ".arcconfig". Libraries here must load.
+ arcanist_load_libraries(
+ idx($runtime_config, 'load', array()),
+ $must_load = true,
+ $lib_source = 'the --config "load=[...]" argument',
+ $working_copy);
+
}
$user_config = $configuration_manager->readUserConfigurationFile();
diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php
--- a/src/configuration/ArcanistConfigurationManager.php
+++ b/src/configuration/ArcanistConfigurationManager.php
@@ -305,7 +305,26 @@
return $system_config;
}
- public function readDefaultConfig() {
+ public function applyRuntimeArcConfig($args) {
+ $arcanist_settings = new ArcanistSettings();
+ $options = $args->getArg('config');
+
+ foreach ($options as $opt) {
+ $opt_config = preg_split('/=/', $opt, 2);
+ if (count($opt_config) !== 2) {
+ throw new ArcanistUsageException("Argument was '{$opt}', but must be ".
+ "'name=value'. For example, history.immutable=true");
+ }
+
+ list($key, $value) = $opt_config;
+ $value = $arcanist_settings->willWriteValue($key, $value);
+ $this->setRuntimeConfig($key, $value);
+ }
+
+ return $this->runtimeConfig;
+ }
+
+ public function readDefaultConfig() {
$settings = new ArcanistSettings();
return $settings->getDefaultSettings();
}
diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php
--- a/src/workflow/ArcanistBaseWorkflow.php
+++ b/src/workflow/ArcanistBaseWorkflow.php
@@ -594,6 +594,7 @@
$arc_config = $this->getArcanistConfiguration();
$command = $this->getCommand();
$spec += $arc_config->getCustomArgumentsForCommand($command);
+
return $spec;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 10, 1:25 PM (3 h, 44 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7119528
Default Alt Text
D9442.id22969.diff (4 KB)
Attached To
Mode
D9442: Allow specifying runtime configuration with --set-config key=value
Attached
Detach File
Event Timeline
Log In to Comment