in src/parser/ArcanistBaseCommitParser.php [124:193]
private function resolveArcRule($rule, $name, $source) {
$name = $this->updateLegacyRuleName($name);
switch ($name) {
case 'verbose':
$this->verbose = true;
$this->log(pht('Enabled verbose mode.'));
break;
case 'prompt':
$reason = pht('it is what you typed when prompted.');
$this->api->setBaseCommitExplanation($reason);
$result = phutil_console_prompt(pht('Against which commit?'));
if (!strlen($result)) {
// Allow the user to continue to the next rule by entering no
// text.
return null;
}
return $result;
case 'local':
case 'user':
case 'project':
case 'runtime':
case 'system':
// Push the other source on top of the list.
array_unshift($this->try, $name);
$this->log(pht("Switching to source '%s'.", $name));
return false;
case 'yield':
// Cycle this source to the end of the list.
$this->try[] = array_shift($this->try);
$this->log(pht("Yielding processing of rules from '%s'.", $source));
return false;
case 'halt':
// Dump the whole stack.
$this->try = array();
$this->log(pht('Halting all rule processing.'));
return false;
case 'skip':
return null;
case 'empty':
case 'upstream':
case 'outgoing':
case 'bookmark':
case 'amended':
case 'this':
return $this->api->resolveBaseCommitRule($rule, $source);
default:
$matches = null;
if (preg_match('/^exec\((.*)\)$/', $name, $matches)) {
$root = $this->api->getWorkingCopyIdentity()->getProjectRoot();
$future = new ExecFuture('%C', $matches[1]);
$future->setCWD($root);
list($err, $stdout) = $future->resolve();
if (!$err) {
return trim($stdout);
} else {
return null;
}
} else if (preg_match('/^nodiff\((.*)\)$/', $name, $matches)) {
return $this->api->resolveBaseCommitRule($rule, $source);
}
throw new ArcanistUsageException(
pht(
"Base commit rule '%s' (from source '%s') ".
"is not a recognized rule.",
$rule,
$source));
}
}