Changeset View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
Show First 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | $arguments = array( | ||||
), | ), | ||||
'no-coverage' => array( | 'no-coverage' => array( | ||||
'help' => 'Always disable coverage information.', | 'help' => 'Always disable coverage information.', | ||||
'passthru' => array( | 'passthru' => array( | ||||
'unit' => true, | 'unit' => true, | ||||
), | ), | ||||
), | ), | ||||
'*' => 'paths', | '*' => 'paths', | ||||
'head' => array( | |||||
'param' => 'commit', | |||||
'help' => "specify the head commit.\n". | |||||
epriestley: This should use full sentences and explicitly state that features will be disabled. | |||||
"This disables many Arcanist/Phabricator features which depend on ". | |||||
"having access to the working copy.", | |||||
Not Done Inline ActionsInstead of --range, maybe this should be something like --head, --tip, --to, or similar? Particularly:
On the other side of things, it seems easy to run arc diff X --head Y instead of arc diff --range X..Y, so we aren't losing anything by doing this. epriestley: Instead of `--range`, maybe this should be something like `--head`, `--tip`, `--to`, or similar? | |||||
Not Done Inline ActionsI mostly wanted to keep it inline with git syntax, since it's well known (if a little confusing) at this point, and it's nice being able to do: $ git log a..b I like --head, though, and all of your points are valid. I'll switch it over to --head. talshiri: I mostly wanted to keep it inline with git syntax, since it's well known (if a little… | |||||
'supports' => array('git'), | |||||
'conflicts' => array( | |||||
'lintall' => '--head suppresses lint.', | |||||
'advice' => '--head suppresses lint.', | |||||
), | |||||
) | |||||
); | ); | ||||
if (phutil_is_windows()) { | if (phutil_is_windows()) { | ||||
unset($arguments['background']); | unset($arguments['background']); | ||||
} | } | ||||
return $arguments; | return $arguments; | ||||
} | } | ||||
Show All 22 Lines | public function run() { | ||||
} | } | ||||
if ($background) { | if ($background) { | ||||
$argv = $this->getPassedArguments(); | $argv = $this->getPassedArguments(); | ||||
if (!PhutilConsoleFormatter::getDisableANSI()) { | if (!PhutilConsoleFormatter::getDisableANSI()) { | ||||
array_unshift($argv, '--ansi'); | array_unshift($argv, '--ansi'); | ||||
} | } | ||||
if ($this->getRepositoryAPI()->supportsCommitRanges()) { | $repo = $this->getRepositoryAPI(); | ||||
$this->getRepositoryAPI()->getBaseCommit(); | $head_commit = $this->getArgument('head'); | ||||
Not Done Inline Actions(null should be the default-by-default, and can be omitted?) epriestley: (`null` should be the default-by-default, and can be omitted?) | |||||
$range_supported = $repo->supportsCommitRanges(); | |||||
if ($head_commit) { | |||||
if (!$range_supported) { | |||||
throw new ArcanistUsageException('Ranged are not supported'); | |||||
Not Done Inline Actions"ranged" -> "Ranges" epriestley: "ranged" -> "Ranges" | |||||
} | |||||
$repo->setHeadCommit($head_commit); | |||||
} | |||||
if ($range_supported) { | |||||
$repo->getBaseCommit(); | |||||
} | } | ||||
Not Done Inline Actions(Probably mooted by the above, but this could use some polish if it sticks around. For example, --range quack will explode right now, I think.) epriestley: (Probably mooted by the above, but this could use some polish if it sticks around. For example… | |||||
Not Done Inline ActionsYeah it will explode :) talshiri: Yeah it will explode :) | |||||
$script = phutil_get_library_root('arcanist').'/../scripts/arcanist.php'; | $script = phutil_get_library_root('arcanist').'/../scripts/arcanist.php'; | ||||
if ($argv) { | if ($argv) { | ||||
$lint_unit = new ExecFuture( | $lint_unit = new ExecFuture( | ||||
'php %s --recon diff --no-diff %Ls', | 'php %s --recon diff --no-diff %Ls', | ||||
$script, | $script, | ||||
$argv); | $argv); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | if ($this->requiresWorkingCopy()) { | ||||
} else if ($this->getArgument('uncommitted')) { | } else if ($this->getArgument('uncommitted')) { | ||||
$this->setCommitMode(self::COMMIT_DISABLE); | $this->setCommitMode(self::COMMIT_DISABLE); | ||||
} else { | } else { | ||||
$this->setCommitMode(self::COMMIT_ALLOW); | $this->setCommitMode(self::COMMIT_ALLOW); | ||||
} | } | ||||
if ($repository_api instanceof ArcanistSubversionAPI) { | if ($repository_api instanceof ArcanistSubversionAPI) { | ||||
$repository_api->limitStatusToPaths($this->getArgument('paths')); | $repository_api->limitStatusToPaths($this->getArgument('paths')); | ||||
} | } | ||||
if (!$this->getArgument('head')) { | |||||
$this->requireCleanWorkingCopy(); | $this->requireCleanWorkingCopy(); | ||||
} | |||||
} catch (ArcanistUncommittedChangesException $ex) { | } catch (ArcanistUncommittedChangesException $ex) { | ||||
if ($repository_api instanceof ArcanistMercurialAPI) { | if ($repository_api instanceof ArcanistMercurialAPI) { | ||||
$use_dirty_changes = false; | $use_dirty_changes = false; | ||||
if ($this->getArgument('uncommitted')) { | if ($this->getArgument('uncommitted')) { | ||||
// OK. | // OK. | ||||
} else { | } else { | ||||
$ok = phutil_console_confirm( | $ok = phutil_console_confirm( | ||||
"You have uncommitted changes in your working copy. You can ". | "You have uncommitted changes in your working copy. You can ". | ||||
▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | if ($repository_api instanceof ArcanistSubversionAPI) { | ||||
// perfectly applyable). | // perfectly applyable). | ||||
$repository_api->overrideSVNBaseRevisionNumber($rev); | $repository_api->overrideSVNBaseRevisionNumber($rev); | ||||
} | } | ||||
$changes = $parser->parseSubversionDiff( | $changes = $parser->parseSubversionDiff( | ||||
$repository_api, | $repository_api, | ||||
$paths); | $paths); | ||||
} else if ($repository_api instanceof ArcanistGitAPI) { | } else if ($repository_api instanceof ArcanistGitAPI) { | ||||
$diff = $repository_api->getFullGitDiff(); | $diff = $repository_api->getFullGitDiff( | ||||
$repository_api->getBaseCommit(), | |||||
$repository_api->getHeadCommit()); | |||||
if (!strlen($diff)) { | if (!strlen($diff)) { | ||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
'No changes found. (Did you specify the wrong commit range?)'); | 'No changes found. (Did you specify the wrong commit range?)'); | ||||
} | } | ||||
$changes = $parser->parseDiff($diff); | $changes = $parser->parseDiff($diff); | ||||
} else if ($repository_api instanceof ArcanistMercurialAPI) { | } else if ($repository_api instanceof ArcanistMercurialAPI) { | ||||
$diff = $repository_api->getFullMercurialDiff(); | $diff = $repository_api->getFullMercurialDiff(); | ||||
if (!strlen($diff)) { | if (!strlen($diff)) { | ||||
▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | /* -( Lint and Unit Tests )------------------------------------------------ */ | ||||
/** | /** | ||||
* @task lintunit | * @task lintunit | ||||
*/ | */ | ||||
private function runLint() { | private function runLint() { | ||||
if ($this->getArgument('nolint') || | if ($this->getArgument('nolint') || | ||||
$this->getArgument('only') || | $this->getArgument('only') || | ||||
$this->isRawDiffSource()) { | $this->isRawDiffSource() || | ||||
$this->getArgument('head')) { | |||||
return ArcanistLintWorkflow::RESULT_SKIP; | return ArcanistLintWorkflow::RESULT_SKIP; | ||||
} | } | ||||
$repository_api = $this->getRepositoryAPI(); | $repository_api = $this->getRepositoryAPI(); | ||||
$this->console->writeOut("Linting...\n"); | $this->console->writeOut("Linting...\n"); | ||||
try { | try { | ||||
$argv = $this->getPassthruArgumentsAsArgv('lint'); | $argv = $this->getPassthruArgumentsAsArgv('lint'); | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | /* -( Lint and Unit Tests )------------------------------------------------ */ | ||||
/** | /** | ||||
* @task lintunit | * @task lintunit | ||||
*/ | */ | ||||
private function runUnit() { | private function runUnit() { | ||||
if ($this->getArgument('nounit') || | if ($this->getArgument('nounit') || | ||||
$this->getArgument('only') || | $this->getArgument('only') || | ||||
$this->isRawDiffSource()) { | $this->isRawDiffSource() || | ||||
$this->getArgument('head')) { | |||||
return ArcanistUnitWorkflow::RESULT_SKIP; | return ArcanistUnitWorkflow::RESULT_SKIP; | ||||
} | } | ||||
$repository_api = $this->getRepositoryAPI(); | $repository_api = $this->getRepositoryAPI(); | ||||
$this->console->writeOut("Running unit tests...\n"); | $this->console->writeOut("Running unit tests...\n"); | ||||
try { | try { | ||||
$argv = $this->getPassthruArgumentsAsArgv('unit'); | $argv = $this->getPassthruArgumentsAsArgv('unit'); | ||||
▲ Show 20 Lines • Show All 1,288 Lines • Show Last 20 Lines |
This should use full sentences and explicitly state that features will be disabled.