diff --git a/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php b/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php index 403c6f72b..bf9d4593c 100644 --- a/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php +++ b/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php @@ -12,6 +12,7 @@ final class ArcanistWorkingCopyIdentity { protected $localConfig; protected $projectConfig; + protected $runtimeConfig; protected $projectRoot; public static function newDummyWorkingCopy() { @@ -87,6 +88,7 @@ protected function __construct($root, array $config) { $this->projectRoot = $root; $this->projectConfig = $config; $this->localConfig = array(); + $this->runtimeConfig = array(); $vc_dirs = array( '.git', @@ -214,8 +216,13 @@ public function getLocalConfig($key, $default=null) { public function getConfigFromAnySource($key, $default = null) { $settings = new ArcanistSettings(); - // try local config first - $pval = $this->getLocalConfig($key); + // try runtime config first + $pval = idx($this->runtimeConfig, $key); + + // try local config + if ($pval === null) { + $pval = $this->getLocalConfig($key); + } // then per-project config if ($pval === null) { @@ -244,4 +251,19 @@ public function getConfigFromAnySource($key, $default = null) { } + /** + * Sets a runtime config value that takes precedence over any static + * config values. + * + * @param key Key to set. + * @param value The value of the key. + * + * @task config + */ + public function setRuntimeConfig($key, $value) { + $this->runtimeConfig[$key] = $value; + + return $this; + } + }