Changeset View
Changeset View
Standalone View
Standalone View
src/parser/ArcanistBaseCommitParser.php
Context not available. | |||||
$spec = array_filter($spec); | $spec = array_filter($spec); | ||||
foreach ($spec as $rule) { | foreach ($spec as $rule) { | ||||
if (strpos($rule, ':') === false) { | if (@strpos($rule, ':') === false) { | ||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
pht( | pht( | ||||
"Rule '%s' is invalid, it must have a type and name like '%s'.", | "Rule '%s' is invalid, it must have a type and name like '%s'.", | ||||
Context not available. | |||||
// NOTE: Returning `null` from this method means "no match". | // NOTE: Returning `null` from this method means "no match". | ||||
// Returning `false` from this method means "stop current ruleset". | // Returning `false` from this method means "stop current ruleset". | ||||
list($type, $name) = explode(':', $rule, 2); | list($type, $name) = @explode(':', $rule, 2); | ||||
switch ($type) { | switch ($type) { | ||||
case 'literal': | case 'literal': | ||||
return $name; | return $name; | ||||
Context not available. | |||||
$reason = pht('it is what you typed when prompted.'); | $reason = pht('it is what you typed when prompted.'); | ||||
$this->api->setBaseCommitExplanation($reason); | $this->api->setBaseCommitExplanation($reason); | ||||
$result = phutil_console_prompt(pht('Against which commit?')); | $result = phutil_console_prompt(pht('Against which commit?')); | ||||
if (!strlen($result)) { | if (!@strlen($result)) { | ||||
// Allow the user to continue to the next rule by entering no | // Allow the user to continue to the next rule by entering no | ||||
// text. | // text. | ||||
return null; | return null; | ||||
Context not available. | |||||
return $this->api->resolveBaseCommitRule($rule, $source); | return $this->api->resolveBaseCommitRule($rule, $source); | ||||
default: | default: | ||||
$matches = null; | $matches = null; | ||||
if (preg_match('/^exec\((.*)\)$/', $name, $matches)) { | if (@preg_match('/^exec\((.*)\)$/', $name, $matches)) { | ||||
$root = $this->api->getWorkingCopyIdentity()->getProjectRoot(); | $root = $this->api->getWorkingCopyIdentity()->getProjectRoot(); | ||||
$future = new ExecFuture('%C', $matches[1]); | $future = new ExecFuture('%C', $matches[1]); | ||||
$future->setCWD($root); | $future->setCWD($root); | ||||
Context not available. | |||||
} else { | } else { | ||||
return null; | return null; | ||||
} | } | ||||
} else if (preg_match('/^nodiff\((.*)\)$/', $name, $matches)) { | } else if (@preg_match('/^nodiff\((.*)\)$/', $name, $matches)) { | ||||
return $this->api->resolveBaseCommitRule($rule, $source); | return $this->api->resolveBaseCommitRule($rule, $source); | ||||
} | } | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0