'local' => '',
'project' => '',
'global' => '',
+ 'system' => '',
);
foreach ($specs as $source => $spec) {
'local',
'project',
'global',
+ 'system',
);
while ($this->try) {
case 'global':
case 'project':
case 'args':
+ case 'system':
// Push the other source on top of the list.
array_unshift($this->try, $name);
$this->log("Switching to source '{$name}'.");
public function resolveBaseCommit() {
$working_copy = $this->getWorkingCopyIdentity();
$global_config = ArcanistBaseWorkflow::readGlobalArcConfig();
+ $system_config = ArcanistBaseWorkflow::readSystemArcConfig();
$parser = new ArcanistBaseCommitParser($this);
$commit = $parser->resolveBaseCommit(
'local' => $working_copy->getLocalConfig('base', ''),
'project' => $working_copy->getConfig('base', ''),
'global' => idx($global_config, 'base', ''),
+ 'system' => idx($system_config, 'base', ''),
));
return $commit;
return $argv;
}
+ public static function getSystemArcConfigLocation() {
+ if (phutil_is_windows()) {
+ // this is a horrible place to put this, but there doesn't seem to be a
+ // non-horrible place on Windows
+ return Filesystem::resolvePath(
+ 'Phabricator/Arcanist/config',
+ getenv('PROGRAMFILES'));
+ } else {
+ return '/etc/arcconfig';
+ }
+ }
+
+ public static function readSystemArcConfig() {
+ $system_config = array();
+ $system_config_path = self::getSystemArcConfigLocation();
+ if (Filesystem::pathExists($system_config_path)) {
+ $file = Filesystem::readFile($system_config_path);
+ if ($file) {
+ $system_config = json_decode($file, true);
+ }
+ }
+ return $system_config;
+ }
public static function getUserConfigurationFileLocation() {
if (phutil_is_windows()) {
return getenv('APPDATA').'/.arcrc';
$argv = $this->getArgument('argv');
$configs = array(
+ 'system' => self::readSystemArcConfig(),
'global' => self::readGlobalArcConfig(),
'local' => $this->readLocalArcConfig(),
);
// lastly, try global (i.e. user-level) config
if ($pval === null) {
$global_config = ArcanistBaseWorkflow::readGlobalArcConfig();
- $pval = idx($global_config, $key, $default);
+ $pval = idx($global_config, $key);
+ }
+
+ if ($pval === null) {
+ $system_config = ArcanistBaseWorkflow::readSystemArcConfig();
+ $pval = idx($system_config, $key);
+ }
+
+ if ($pval === null) {
+ $pval = $default;
}
return $pval;