1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Make "arc land" prompt on "Changes Planned" revisions more explicit

Summary: Fixes T10233. See PHI231. Users sometimes believe this warning is a bug and/or don't understand how they're supposed to resolve it.

Test Plan: Ran `arc land` on a revision in "Changes Planned", got a sensible prompt. Ran `arc land` on a revision in another non-accepted state, got more or less the old prompt.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T10233

Differential Revision: https://secure.phabricator.com/D18807
This commit is contained in:
epriestley 2017-11-30 07:52:28 -08:00
parent 9054604214
commit f4c80a114d

View file

@ -694,6 +694,8 @@ EOTEXT
$rev_title = $this->revision['title'];
$rev_auxiliary = idx($this->revision, 'auxiliary', array());
$full_name = pht('D%d: %s', $rev_id, $rev_title);
if ($this->revision['authorPHID'] != $this->getUserPHID()) {
$other_author = $this->getConduit()->callMethodSynchronous(
'user.query',
@ -706,17 +708,46 @@ EOTEXT
"This %s has revision '%s' but you are not the author. Land this ".
"revision by %s?",
$this->branchType,
"D{$rev_id}: {$rev_title}",
$full_name,
$other_author));
if (!$ok) {
throw new ArcanistUserAbortException();
}
}
if ($rev_status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
$ok = phutil_console_confirm(pht(
"Revision '%s' has not been accepted. Continue anyway?",
"D{$rev_id}: {$rev_title}"));
$state_warning = null;
$state_header = null;
if ($rev_status == ArcanistDifferentialRevisionStatus::CHANGES_PLANNED) {
$state_header = pht('REVISION HAS CHANGES PLANNED');
$state_warning = pht(
'The revision you are landing ("%s") is currently in the "%s" state, '.
'indicating that you expect to revise it before moving forward.'.
"\n\n".
'Normally, you should resubmit it for review and wait until it is '.
'"%s" by reviewers before you continue.'.
"\n\n".
'To resubmit the revision for review, either: update the revision '.
'with revised changes; or use "Request Review" from the web interface.',
$full_name,
pht('Changes Planned'),
pht('Accepted'));
} else if ($rev_status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
$state_header = pht('REVISION HAS NOT BEEN ACCEPTED');
$state_warning = pht(
'The revision you are landing ("%s") has not been "%s" by reviewers.',
$full_name,
pht('Accepted'));
}
if ($state_warning !== null) {
$prompt = pht('Land revision in the wrong state?');
id(new PhutilConsoleBlock())
->addParagraph(tsprintf('<bg:yellow>** %s **</bg>', $state_header))
->addParagraph(tsprintf('%B', $state_warning))
->draw();
$ok = phutil_console_confirm($prompt);
if (!$ok) {
throw new ArcanistUserAbortException();
}