public function run() {
$this->console = PhutilConsole::getConsole();
+ $this->runRepositoryAPISetup();
+
if ($this->getArgument('no-diff')) {
$this->removeScratchFile('diff-result.json');
$data = $this->runLintUnit();
if (!PhutilConsoleFormatter::getDisableANSI()) {
array_unshift($argv, '--ansi');
}
+
$lint_unit = new ExecFuture(
'php %s --recon diff --no-diff %Ls',
phutil_get_library_root('arcanist').'/../scripts/arcanist.php',
return 0;
}
- private function runDiffSetupBasics() {
- if ($this->requiresRepositoryAPI()) {
- $repository_api = $this->getRepositoryAPI();
- if ($this->getArgument('less-context')) {
- $repository_api->setDiffLinesOfContext(3);
- }
+ private function runRepositoryAPISetup() {
+ if (!$this->requiresRepositoryAPI()) {
+ return;
+ }
- $repository_api->setBaseCommitArgumentRules(
- $this->getArgument('base', ''));
+ $repository_api = $this->getRepositoryAPI();
+ if ($this->getArgument('less-context')) {
+ $repository_api->setDiffLinesOfContext(3);
+ }
- if ($repository_api->supportsRelativeLocalCommits()) {
+ $repository_api->setBaseCommitArgumentRules(
+ $this->getArgument('base', ''));
- // Parse the relative commit as soon as we can, to avoid generating
- // caches we need to drop later and expensive discovery operations
- // (particularly in Mercurial).
+ if ($repository_api->supportsRelativeLocalCommits()) {
- $relative = $this->getArgument('paths');
- if ($relative) {
- $repository_api->parseRelativeLocalCommit($relative);
- }
+ // Parse the relative commit as soon as we can, to avoid generating
+ // caches we need to drop later and expensive discovery operations
+ // (particularly in Mercurial).
+
+ $relative = $this->getArgument('paths');
+ if ($relative) {
+ $repository_api->parseRelativeLocalCommit($relative);
}
}
+ }
+ private function runDiffSetupBasics() {
$output_json = $this->getArgument('json');
if ($output_json) {
// TODO: We should move this to a higher-level and put an indirection
$argv[] = '--rev';
$argv[] = $repository_api->getRelativeCommit();
}
+
$lint_workflow = $this->buildChildWorkflow('lint', $argv);
if ($this->shouldAmend()) {