mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-16 17:51:10 +01:00
Improve help and prompts for the "--draft" flag
Summary: See PHI458. The help text and prompting for "arc diff --draft" aren't very clear about whether updating publishes or not, nor about whether you need to keep passing "--draft" every time. Make these behaviors more clear. Test Plan: - Ran `arc help diff`, read text. - Updated a draft with "--draft", got new warning but it went through. - Updated a published revision with "--draft", got new error. Differential Revision: https://secure.phabricator.com/D19229
This commit is contained in:
parent
e64cbd3ba7
commit
49a3ae9dad
1 changed files with 30 additions and 8 deletions
|
@ -22,6 +22,7 @@ final class ArcanistDiffWorkflow extends ArcanistWorkflow {
|
||||||
private $commitMessageFromRevision;
|
private $commitMessageFromRevision;
|
||||||
private $hitAutotargets;
|
private $hitAutotargets;
|
||||||
private $revisionTransactions;
|
private $revisionTransactions;
|
||||||
|
private $revisionIsDraft;
|
||||||
|
|
||||||
const STAGING_PUSHED = 'pushed';
|
const STAGING_PUSHED = 'pushed';
|
||||||
const STAGING_USER_SKIP = 'user.skip';
|
const STAGING_USER_SKIP = 'user.skip';
|
||||||
|
@ -192,8 +193,10 @@ EOTEXT
|
||||||
),
|
),
|
||||||
'draft' => array(
|
'draft' => array(
|
||||||
'help' => pht(
|
'help' => pht(
|
||||||
'Hold this revision as a draft instead of submitting it for '.
|
'Create a draft revision so you can look over your changes before '.
|
||||||
'review.'),
|
'involving anyone else. Other users will not be notified about the '.
|
||||||
|
'revision until you later use "Request Review" to publish it. You '.
|
||||||
|
'can still share the draft by giving someone the link.'),
|
||||||
'conflicts' => array(
|
'conflicts' => array(
|
||||||
'edit' => null,
|
'edit' => null,
|
||||||
'only' => null,
|
'only' => null,
|
||||||
|
@ -528,13 +531,26 @@ EOTEXT
|
||||||
if ($is_draft) {
|
if ($is_draft) {
|
||||||
// TODO: In at least some cases, we could raise this earlier in the
|
// TODO: In at least some cases, we could raise this earlier in the
|
||||||
// workflow to save users some time before the workflow aborts.
|
// workflow to save users some time before the workflow aborts.
|
||||||
|
if ($this->revisionIsDraft) {
|
||||||
|
$this->writeWarn(
|
||||||
|
pht('ALREADY A DRAFT'),
|
||||||
|
pht(
|
||||||
|
'You are updating a revision ("%s") with the "--draft" flag, '.
|
||||||
|
'but this revision is already a draft. You only need to '.
|
||||||
|
'provide the "--draft" flag when creating a revision. Draft '.
|
||||||
|
'revisions are not published until you explicitly request '.
|
||||||
|
'review from the web UI.',
|
||||||
|
$commit_message->getRevisionMonogram()));
|
||||||
|
} else {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
pht(
|
pht(
|
||||||
'You are updating a revision ("%s") but have specified '.
|
'You are updating a revision ("%s") with the "--draft" flag, '.
|
||||||
'the "--draft" flag. Only newly created revisions can be '.
|
'but this revision has already been published for review. '.
|
||||||
'held as drafts.',
|
'You can not turn a revision back into a draft once it has '.
|
||||||
|
'been published.',
|
||||||
$commit_message->getRevisionMonogram()));
|
$commit_message->getRevisionMonogram()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = $conduit->callMethodSynchronous(
|
$result = $conduit->callMethodSynchronous(
|
||||||
'differential.updaterevision',
|
'differential.updaterevision',
|
||||||
|
@ -1793,6 +1809,12 @@ EOTEXT
|
||||||
|
|
||||||
$this->checkRevisionOwnership($revision);
|
$this->checkRevisionOwnership($revision);
|
||||||
|
|
||||||
|
// TODO: Save this status to improve a prompt later. See PHI458. This is
|
||||||
|
// extra awful until we move to "differential.revision.search" because
|
||||||
|
// the "differential.query" method doesn't return a real draft status for
|
||||||
|
// compatibility.
|
||||||
|
$this->revisionIsDraft = (idx($revision, 'statusName') === 'Draft');
|
||||||
|
|
||||||
$message = $this->getConduit()->callMethodSynchronous(
|
$message = $this->getConduit()->callMethodSynchronous(
|
||||||
'differential.getcommitmessage',
|
'differential.getcommitmessage',
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Reference in a new issue