Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistDiffWorkflow.php
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | $arguments = array( | ||||
'supports' => array( | 'supports' => array( | ||||
'git', | 'git', | ||||
// TODO: Support mercurial. | // TODO: Support mercurial. | ||||
), | ), | ||||
'short' => 'C', | 'short' => 'C', | ||||
'param' => 'commit', | 'param' => 'commit', | ||||
'help' => pht('Read revision information from a specific commit.'), | 'help' => pht('Read revision information from a specific commit.'), | ||||
'conflicts' => array( | 'conflicts' => array( | ||||
'only' => null, | |||||
'preview' => null, | 'preview' => null, | ||||
'update' => null, | 'update' => null, | ||||
), | ), | ||||
), | ), | ||||
'edit' => array( | 'edit' => array( | ||||
'supports' => array( | 'supports' => array( | ||||
'git', | 'git', | ||||
'hg', | 'hg', | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | $arguments = array( | ||||
), | ), | ||||
'create' => array( | 'create' => array( | ||||
'help' => pht('Always create a new revision.'), | 'help' => pht('Always create a new revision.'), | ||||
'conflicts' => array( | 'conflicts' => array( | ||||
'edit' => pht( | 'edit' => pht( | ||||
'%s can not be used with %s.', | '%s can not be used with %s.', | ||||
'--create', | '--create', | ||||
'--edit'), | '--edit'), | ||||
'only' => pht( | |||||
'%s can not be used with %s.', | |||||
'--create', | |||||
'--only'), | |||||
'preview' => pht( | 'preview' => pht( | ||||
'%s can not be used with %s.', | '%s can not be used with %s.', | ||||
'--create', | '--create', | ||||
'--preview'), | '--preview'), | ||||
'update' => pht( | 'update' => pht( | ||||
'%s can not be used with %s.', | '%s can not be used with %s.', | ||||
'--create', | '--create', | ||||
'--update'), | '--update'), | ||||
Show All 10 Lines | $arguments = array( | ||||
'help' => pht('Do not run lint.'), | 'help' => pht('Do not run lint.'), | ||||
'conflicts' => array( | 'conflicts' => array( | ||||
'lintall' => pht('%s suppresses lint.', '--nolint'), | 'lintall' => pht('%s suppresses lint.', '--nolint'), | ||||
'advice' => pht('%s suppresses lint.', '--nolint'), | 'advice' => pht('%s suppresses lint.', '--nolint'), | ||||
'apply-patches' => pht('%s suppresses lint.', '--nolint'), | 'apply-patches' => pht('%s suppresses lint.', '--nolint'), | ||||
'never-apply-patches' => pht('%s suppresses lint.', '--nolint'), | 'never-apply-patches' => pht('%s suppresses lint.', '--nolint'), | ||||
), | ), | ||||
), | ), | ||||
'only' => array( | |||||
'help' => pht( | |||||
'Only generate a diff, without running lint, unit tests, or other '. | |||||
'auxiliary steps. See also %s.', | |||||
'--preview'), | |||||
'conflicts' => array( | |||||
'preview' => null, | |||||
'message' => pht('%s does not affect revisions.', '--only'), | |||||
'edit' => pht('%s does not affect revisions.', '--only'), | |||||
'lintall' => pht('%s suppresses lint.', '--only'), | |||||
'advice' => pht('%s suppresses lint.', '--only'), | |||||
'apply-patches' => pht('%s suppresses lint.', '--only'), | |||||
'never-apply-patches' => pht('%s suppresses lint.', '--only'), | |||||
), | |||||
), | |||||
'preview' => array( | 'preview' => array( | ||||
'help' => pht( | 'help' => pht( | ||||
'Instead of creating or updating a revision, only create a diff, '. | 'Instead of creating or updating a revision, only create a diff, '. | ||||
'which you may later attach to a revision. This still runs lint '. | 'which you may later attach to a revision. This still runs lint '. | ||||
'unit tests. See also %s.', | 'unit tests.'), | ||||
'--only'), | |||||
'conflicts' => array( | 'conflicts' => array( | ||||
'only' => null, | |||||
'edit' => pht('%s does affect revisions.', '--preview'), | 'edit' => pht('%s does affect revisions.', '--preview'), | ||||
'message' => pht('%s does not update any revision.', '--preview'), | 'message' => pht('%s does not update any revision.', '--preview'), | ||||
), | ), | ||||
), | ), | ||||
'encoding' => array( | 'encoding' => array( | ||||
'param' => 'encoding', | 'param' => 'encoding', | ||||
'help' => pht( | 'help' => pht( | ||||
'Attempt to convert non UTF-8 hunks into specified encoding.'), | 'Attempt to convert non UTF-8 hunks into specified encoding.'), | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | $arguments = array( | ||||
'revision, update some fields from the local commit message.'), | 'revision, update some fields from the local commit message.'), | ||||
'supports' => array( | 'supports' => array( | ||||
'hg', | 'hg', | ||||
'git', | 'git', | ||||
), | ), | ||||
'conflicts' => array( | 'conflicts' => array( | ||||
'use-commit-message' => true, | 'use-commit-message' => true, | ||||
'update' => true, | 'update' => true, | ||||
'only' => true, | |||||
'preview' => true, | 'preview' => true, | ||||
'raw' => true, | 'raw' => true, | ||||
'raw-command' => true, | 'raw-command' => true, | ||||
'message-file' => true, | 'message-file' => true, | ||||
), | ), | ||||
), | ), | ||||
'reviewers' => array( | 'reviewers' => array( | ||||
'param' => 'usernames', | 'param' => 'usernames', | ||||
'help' => pht('When creating a revision, add reviewers.'), | 'help' => pht('When creating a revision, add reviewers.'), | ||||
'conflicts' => array( | 'conflicts' => array( | ||||
'only' => true, | |||||
'preview' => true, | 'preview' => true, | ||||
'update' => true, | 'update' => true, | ||||
), | ), | ||||
), | ), | ||||
'cc' => array( | 'cc' => array( | ||||
'param' => 'usernames', | 'param' => 'usernames', | ||||
'help' => pht('When creating a revision, add CCs.'), | 'help' => pht('When creating a revision, add CCs.'), | ||||
'conflicts' => array( | 'conflicts' => array( | ||||
'only' => true, | |||||
'preview' => true, | 'preview' => true, | ||||
'update' => true, | 'update' => true, | ||||
), | ), | ||||
), | ), | ||||
'skip-binaries' => array( | 'skip-binaries' => array( | ||||
'help' => pht('Do not upload binaries (like images).'), | 'help' => pht('Do not upload binaries (like images).'), | ||||
), | ), | ||||
'skip-staging' => array( | 'skip-staging' => array( | ||||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | protected function shouldOnlyCreateDiff() { | ||||
if ($this->getArgument('use-commit-message')) { | if ($this->getArgument('use-commit-message')) { | ||||
return false; | return false; | ||||
} | } | ||||
if ($this->isRawDiffSource()) { | if ($this->isRawDiffSource()) { | ||||
return true; | return true; | ||||
} | } | ||||
return $this->getArgument('preview') || | return $this->getArgument('preview'); | ||||
$this->getArgument('only'); | |||||
} | } | ||||
private function generateAffectedPaths() { | private function generateAffectedPaths() { | ||||
if ($this->isRawDiffSource()) { | if ($this->isRawDiffSource()) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$repository_api = $this->getRepositoryAPI(); | $repository_api = $this->getRepositoryAPI(); | ||||
▲ Show 20 Lines • Show All 420 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->isRawDiffSource() || | $this->isRawDiffSource() || | ||||
$this->getArgument('head')) { | $this->getArgument('head')) { | ||||
return ArcanistLintWorkflow::RESULT_SKIP; | return ArcanistLintWorkflow::RESULT_SKIP; | ||||
} | } | ||||
$repository_api = $this->getRepositoryAPI(); | $repository_api = $this->getRepositoryAPI(); | ||||
$this->console->writeOut("%s\n", pht('Linting...')); | $this->console->writeOut("%s\n", pht('Linting...')); | ||||
▲ 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->isRawDiffSource() || | $this->isRawDiffSource() || | ||||
$this->getArgument('head')) { | $this->getArgument('head')) { | ||||
return ArcanistUnitWorkflow::RESULT_SKIP; | return ArcanistUnitWorkflow::RESULT_SKIP; | ||||
} | } | ||||
$repository_api = $this->getRepositoryAPI(); | $repository_api = $this->getRepositoryAPI(); | ||||
$this->console->writeOut("%s\n", pht('Running unit tests...')); | $this->console->writeOut("%s\n", pht('Running unit tests...')); | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | |||||
/* -( Commit and Update Messages )----------------------------------------- */ | /* -( Commit and Update Messages )----------------------------------------- */ | ||||
/** | /** | ||||
* @task message | * @task message | ||||
*/ | */ | ||||
private function buildCommitMessage() { | private function buildCommitMessage() { | ||||
if ($this->getArgument('preview') || $this->getArgument('only')) { | if ($this->getArgument('preview')) { | ||||
return null; | return null; | ||||
} | } | ||||
$is_create = $this->getArgument('create'); | $is_create = $this->getArgument('create'); | ||||
$is_update = $this->getArgument('update'); | $is_update = $this->getArgument('update'); | ||||
$is_raw = $this->isRawDiffSource(); | $is_raw = $this->isRawDiffSource(); | ||||
$is_message = $this->getArgument('use-commit-message'); | $is_message = $this->getArgument('use-commit-message'); | ||||
$is_verbatim = $this->getArgument('verbatim'); | $is_verbatim = $this->getArgument('verbatim'); | ||||
▲ Show 20 Lines • Show All 1,493 Lines • Show Last 20 Lines |