]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Add "--reviewers" and "--ccs" flags to arc diff
authorepriestley <git@epriestley.com>
Tue, 22 May 2012 21:38:53 +0000 (14:38 -0700)
committerepriestley <git@epriestley.com>
Tue, 22 May 2012 21:38:53 +0000 (14:38 -0700)
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

src/workflow/diff/ArcanistDiffWorkflow.php

index 8fc23f57a9f50f167838a0c4e5f585118278f117..c52ed14c5a4a7f91ec7baa81d49a42d2698ca841 100644 (file)
@@ -318,6 +318,24 @@ EOTEXT
           '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 @@ EOTEXT
     $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();