r114898 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114897‎ | r114898 | r114899 >
Date:22:23, 13 April 2012
Author:awjrichards
Status:new
Tags:
Comment:
Added some method docs, added executeAbandon() method, now using --verified=+1 notation for submit
Modified paths:
  • /trunk/tools/gerrit-dippybird/dippy-bird.php (modified) (history)

Diff [purge]

Index: trunk/tools/gerrit-dippybird/dippy-bird.php
@@ -44,7 +44,7 @@
4545 // 'approve' => 'executeApprove',
4646 // 'verify' => 'executeVerify',
4747 'submit' => 'executeSubmit',
48 - // 'abandon' => 'executeAbandon',
 48+ 'abandon' => 'executeAbandon',
4949 );
5050
5151 public function __construct() {
@@ -55,6 +55,12 @@
5656 }
5757 }
5858
 59+ /**
 60+ * Execution method
 61+ *
 62+ * Performs sanity check, execute specific gerrit query, then performs
 63+ * specified action.
 64+ */
5965 public function dip() {
6066 $this->handleOpts();
6167 if ( !$this->isConfigSane() ) {
@@ -79,6 +85,7 @@
8086 }
8187
8288 /**
 89+ * Execute specified gerrit query
8390 * @return array
8491 */
8592 public function executeQuery() {
@@ -103,15 +110,34 @@
104111 }
105112
106113 /**
 114+ * Execute gerrit review --submit to review and submit patchsets
107115 * @param array $results
108 - * @return mixed
109116 */
110117 public function executeSubmit( $results ) {
111 - $review_opts = '--verified 1 --code-review 2';
 118+ $review_opts = '--verified=+1 --code-review=+2';
112119 $action = 'submit';
113120 $this->gerritReviewWrapper( $results, $action, $review_opts );
114121 }
115122
 123+ /**
 124+ * Execute gerrit review --abandon to abandon patchsets
 125+ * @param array $results
 126+ */
 127+ public function executeAbandon( $results ) {
 128+ $action = 'abandon';
 129+ $this->gerritReviewWrapper( $results, $action );
 130+ }
 131+
 132+ /**
 133+ * A wrapper around the 'gerrit review' command
 134+ *
 135+ * Given a set of results from a gerrit query, perform one of the available
 136+ * gerrit review actions
 137+ * @see $this->validActions
 138+ * @param array $results
 139+ * @param string $action
 140+ * @param string $review_opts
 141+ */
116142 protected function gerritReviewWrapper( $results, $action, $review_opts = '' ) {
117143 // If there are less than two items in the array, there are no changesets on which to operate
118144 if ( count( $results ) < 2 ) {