Skip to content
Browse files

Add "--reviewers" and "--ccs" flags to arc diff

Summary: Request from @csilvers, whose team is alergic to $EDITOR.

Test Plan:
Adding reviewers and CCs to this diff via CLI. The initial commit message for this diff is:

  Add "--reviewers" and "--ccs" flags to arc diff

  Request from @csilvers, whose team is alergic to $EDITOR.

  Tested: Adding reviewers and CCs to this diff via CLI. The initial commit message for this diff is:
  (...infinite recursion omitted...)

Reviewers: csilvers, btrahan

Reviewed By: csilvers

CC: aran

Differential Revision: https://secure.phabricator.com/D2538
  • Loading branch information...
1 parent 04606d2 commit 833e8355d8dc6ca4d6eef6803fdc8819819e02ab @epriestley epriestley committed May 22, 2012
Showing with 39 additions and 0 deletions.
  1. +39 −0 src/workflow/diff/ArcanistDiffWorkflow.php
View
39 src/workflow/diff/ArcanistDiffWorkflow.php
@@ -318,6 +318,24 @@ public function getArguments() {
'message-file' => true,
),
),
+ 'reviewers' => array(
+ 'param' => 'usernames',
+ 'help' => 'When creating a revision, add reviewers.',
+ 'conflicts' => array(
+ 'only' => true,
+ 'preview' => true,
+ 'update' => true,
+ ),
+ ),
+ 'cc' => array(
+ 'param' => 'usernames',
+ 'help' => 'When creating a revision, add CCs.',
+ 'conflicts' => array(
+ 'only' => true,
+ 'preview' => true,
+ 'update' => true,
+ ),
+ ),
'*' => 'paths',
);
}
@@ -1653,6 +1671,27 @@ private function parseCommitMessagesIntoFields(array $local) {
$conduit = $this->getConduit();
$local = ipull($local, null, 'commit');
+ // If the user provided "--reviewers" or "--ccs", add a faux message to
+ // the list with the implied fields.
+
+ $faux_message = array();
+ if ($this->getArgument('reviewers')) {
+ $faux_message[] = 'Reviewers: '.$this->getArgument('reviewers');
+ }
+ if ($this->getArgument('cc')) {
+ $faux_message[] = 'CC: '.$this->getArgument('cc');
+ }
+
+ if ($faux_message) {
+ $faux_message = implode("\n\n", $faux_message);
+ $local = array(
+ '(Flags) ' => array(
+ 'message' => $faux_message,
+ 'summary' => 'Command-Line Flags',
+ ),
+ ) + $local;
+ }
+
// Build a human-readable list of the commits, so we can show the user which
// commits are included in the diff.
$included = array();

0 comments on commit 833e835

Please sign in to comment.
Something went wrong with that request. Please try again.