https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114898
Revision: 114898
Author: awjrichards
Date: 2012-04-13 22:23:15 +0000 (Fri, 13 Apr 2012)
Log Message:
-----------
Added some method docs, added executeAbandon() method, now using --verified=+1
notation for submit
Modified Paths:
--------------
trunk/tools/gerrit-dippybird/dippy-bird.php
Modified: trunk/tools/gerrit-dippybird/dippy-bird.php
===================================================================
--- trunk/tools/gerrit-dippybird/dippy-bird.php 2012-04-13 22:16:03 UTC (rev
114897)
+++ trunk/tools/gerrit-dippybird/dippy-bird.php 2012-04-13 22:23:15 UTC (rev
114898)
@@ -44,7 +44,7 @@
// 'approve' => 'executeApprove',
// 'verify' => 'executeVerify',
'submit' => 'executeSubmit',
- // 'abandon' => 'executeAbandon',
+ 'abandon' => 'executeAbandon',
);
public function __construct() {
@@ -55,6 +55,12 @@
}
}
+ /**
+ * Execution method
+ *
+ * Performs sanity check, execute specific gerrit query, then performs
+ * specified action.
+ */
public function dip() {
$this->handleOpts();
if ( !$this->isConfigSane() ) {
@@ -79,6 +85,7 @@
}
/**
+ * Execute specified gerrit query
* @return array
*/
public function executeQuery() {
@@ -103,15 +110,34 @@
}
/**
+ * Execute gerrit review --submit to review and submit patchsets
* @param array $results
- * @return mixed
*/
public function executeSubmit( $results ) {
- $review_opts = '--verified 1 --code-review 2';
+ $review_opts = '--verified=+1 --code-review=+2';
$action = 'submit';
$this->gerritReviewWrapper( $results, $action, $review_opts );
}
+ /**
+ * Execute gerrit review --abandon to abandon patchsets
+ * @param array $results
+ */
+ public function executeAbandon( $results ) {
+ $action = 'abandon';
+ $this->gerritReviewWrapper( $results, $action );
+ }
+
+ /**
+ * A wrapper around the 'gerrit review' command
+ *
+ * Given a set of results from a gerrit query, perform one of the
available
+ * gerrit review actions
+ * @see $this->validActions
+ * @param array $results
+ * @param string $action
+ * @param string $review_opts
+ */
protected function gerritReviewWrapper( $results, $action, $review_opts
= '' ) {
// If there are less than two items in the array, there are no
changesets on which to operate
if ( count( $results ) < 2 ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs