mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Restore "arc patch D12345" syntax
Summary: I only dropped this because it's slightly inconvient to accommodate, but empirically it's pretty confusing to users (who often use --diff 12345 when they mean --revision 12345). Test Plan: Ran "arc patch D45", "arc patch --revision 45", "arc help patch" Reviewed By: tuomaspelkonen Reviewers: tuomaspelkonen, jungejason, aran CC: aran, tuomaspelkonen Differential Revision: 241
This commit is contained in:
parent
1fdead8c20
commit
caed8a2830
1 changed files with 34 additions and 14 deletions
|
@ -33,7 +33,11 @@ final class ArcanistPatchWorkflow extends ArcanistBaseWorkflow {
|
||||||
|
|
||||||
public function getCommandHelp() {
|
public function getCommandHelp() {
|
||||||
return phutil_console_format(<<<EOTEXT
|
return phutil_console_format(<<<EOTEXT
|
||||||
**patch** __source__
|
**patch** __D12345__
|
||||||
|
**patch** __--revision__ __revision_id__
|
||||||
|
**patch** __--diff__ __diff_id__
|
||||||
|
**patch** __--patch__ __file__
|
||||||
|
**patch** __--arcbundle__ __bundlefile__
|
||||||
Supports: git, svn
|
Supports: git, svn
|
||||||
Apply the changes in a Differential revision, patchfile, or arc
|
Apply the changes in a Differential revision, patchfile, or arc
|
||||||
bundle to the working copy.
|
bundle to the working copy.
|
||||||
|
@ -48,7 +52,8 @@ EOTEXT
|
||||||
'paramtype' => 'complete',
|
'paramtype' => 'complete',
|
||||||
'help' =>
|
'help' =>
|
||||||
"Apply changes from a Differential revision, using the most recent ".
|
"Apply changes from a Differential revision, using the most recent ".
|
||||||
"diff that has been attached to it.",
|
"diff that has been attached to it. You can run 'arc patch D12345' ".
|
||||||
|
"as a shorthand for this.",
|
||||||
),
|
),
|
||||||
'diff' => array(
|
'diff' => array(
|
||||||
'param' => 'diff_id',
|
'param' => 'diff_id',
|
||||||
|
@ -70,6 +75,7 @@ EOTEXT
|
||||||
'help' =>
|
'help' =>
|
||||||
"Apply changes from a git patchfile or unified patchfile.",
|
"Apply changes from a git patchfile or unified patchfile.",
|
||||||
),
|
),
|
||||||
|
'*' => 'name',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,21 +99,35 @@ EOTEXT
|
||||||
$requested++;
|
$requested++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$use_revision_id = null;
|
||||||
|
if ($this->getArgument('name')) {
|
||||||
|
$namev = $this->getArgument('name');
|
||||||
|
if (count($namev) > 1) {
|
||||||
|
throw new ArcanistUsageException("Specify at most one revision name.");
|
||||||
|
}
|
||||||
|
$source = self::SOURCE_REVISION;
|
||||||
|
$requested++;
|
||||||
|
|
||||||
|
$use_revision_id = $this->normalizeRevisionID(head($namev));
|
||||||
|
}
|
||||||
|
|
||||||
if ($requested === 0) {
|
if ($requested === 0) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"Specify one of '--revision <revision_id>' (to select the current ".
|
"Specify one of 'D12345', '--revision <revision_id>' (to select the ".
|
||||||
"changes attached to a Differential revision), '--diff <diff_id>' ".
|
"current changes attached to a Differential revision), ".
|
||||||
"(to select a specific, out-of-date diff or a diff which is not ".
|
"'--diff <diff_id>' (to select a specific, out-of-date diff or a ".
|
||||||
"attached to a revision), '--arcbundle <file>' or '--patch <file>' ".
|
"diff which is not attached to a revision), '--arcbundle <file>' ".
|
||||||
"to choose a patch source.");
|
"or '--patch <file>' to choose a patch source.");
|
||||||
} else if ($requested > 1) {
|
} else if ($requested > 1) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"Options '--revision', '--diff', '--arcbundle' and '--patch' are ".
|
"Options 'D12345', '--revision', '--diff', '--arcbundle' and ".
|
||||||
"not compatible. Choose exactly one patch source.");
|
"'--patch' are not compatible. Choose exactly one patch source.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->source = $source;
|
$this->source = $source;
|
||||||
$this->sourceParam = $this->getArgument($source);
|
$this->sourceParam = nonempty(
|
||||||
|
$use_revision_id,
|
||||||
|
$this->getArgument($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function requiresConduit() {
|
public function requiresConduit() {
|
||||||
|
|
Loading…
Reference in a new issue