mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Remind user about 'arc amend' when they try to land a branch onto itself
Summary: If you develop in "master" and try to "arc land", you get an error. You can reasonably "arc amend" in this situation, most of the time. Give the user an explicit pointer. Test Plan: $ arc land master Usage Exception: You can not land a branch onto itself -- you are trying to land 'master' onto 'master'. For more information on how to push changes, see 'Pushing and Closing Revisions' in 'Arcanist User Guide: arc diff' in the documentation. You may be able to 'arc amend' instead. Reviewers: csilvers, btrahan Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2547
This commit is contained in:
parent
833e8355d8
commit
833ae9c152
1 changed files with 9 additions and 3 deletions
|
@ -141,12 +141,18 @@ EOTEXT
|
|||
$remote = $this->getArgument('remote', 'origin');
|
||||
$onto = $this->getArgument('onto', $onto_default);
|
||||
|
||||
$is_immutable = $this->isHistoryImmutable();
|
||||
|
||||
if ($onto == $branch) {
|
||||
throw new ArcanistUsageException(
|
||||
$message =
|
||||
"You can not land a branch onto itself -- you are trying to land ".
|
||||
"'{$branch}' onto '{$onto}'. For more information on how to push ".
|
||||
"changes, see 'Pushing and Closing Revisions' in ".
|
||||
"'Arcanist User Guide: arc diff' in the documentation.");
|
||||
"'Arcanist User Guide: arc diff' in the documentation.";
|
||||
if (!$is_immutable) {
|
||||
$message .= " You may be able to 'arc amend' instead.";
|
||||
}
|
||||
throw new ArcanistUsageException($message);
|
||||
}
|
||||
|
||||
if ($this->getArgument('merge')) {
|
||||
|
@ -154,7 +160,7 @@ EOTEXT
|
|||
} else if ($this->getArgument('squash')) {
|
||||
$use_squash = true;
|
||||
} else {
|
||||
$use_squash = !$this->isHistoryImmutable();
|
||||
$use_squash = !$is_immutable;
|
||||
}
|
||||
|
||||
list($err) = $repository_api->execManualLocal(
|
||||
|
|
Loading…
Reference in a new issue