From 833e8355d8dc6ca4d6eef6803fdc8819819e02ab Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 22 May 2012 14:38:53 -0700 Subject: [PATCH] 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 --- src/workflow/diff/ArcanistDiffWorkflow.php | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/workflow/diff/ArcanistDiffWorkflow.php b/src/workflow/diff/ArcanistDiffWorkflow.php index 8fc23f57..c52ed14c 100644 --- a/src/workflow/diff/ArcanistDiffWorkflow.php +++ b/src/workflow/diff/ArcanistDiffWorkflow.php @@ -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();