Siebrand has submitted this change and it was merged.

Change subject: Merge patch sets when any gerrit repos were involved
......................................................................


Merge patch sets when any gerrit repos were involved

Change-Id: I1130d2e01591f2b4d7259350837b7a836f808e0f
---
A bin/merge-wmgerrit-patches
M repong/repong.php
2 files changed, 29 insertions(+), 3 deletions(-)

Approvals:
  Siebrand: Verified; Looks good to me, approved



diff --git a/bin/merge-wmgerrit-patches b/bin/merge-wmgerrit-patches
new file mode 100755
index 0000000..9d39db2
--- /dev/null
+++ b/bin/merge-wmgerrit-patches
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+U="l10n-bot"
+GERRIT="$u...@gerrit.wikimedia.org -p 29418 gerrit"
+
+for i in `ssh $GERRIT query --format=TEXT owner:$U status:open | grep '  url:' 
|cut -d/ -f5 |sort`
+do
+    ssh $GERRIT gerrit review $i,1 --code-review 2 --verified 2 --submit
+done
diff --git a/repong/repong.php b/repong/repong.php
index bc0d773..27477a4 100644
--- a/repong/repong.php
+++ b/repong/repong.php
@@ -5,25 +5,31 @@
 require_once __DIR__ . '/vendor/autoload.php';
 
 class RepoNg {
+       protected $bindir;
        protected $meta;
        protected $config;
 
        public function __construct( array $meta, array $config ) {
+               $this->bindir = realpath( __DIR__ . '/../bin' );
+
+               if ( $this->bindir === false ) {
+                       throw new RuntimeException( __DIR__ . '/../bin/ does 
not exist' );
+               }
+
                $this->meta = $meta;
                $this->config = $config;
        }
 
        public function update() {
-               $bindir = realpath( __DIR__ . '/../bin' );
                $base = $this->meta['basepath'];
 
                foreach ( $this->config['repos'] as $name => $repo ) {
                        if ( $repo['type'] === 'git' ) {
                                $branch = isset( $repo['branch'] ) ? 
$repo['branch'] : 'master';
-                               $command = "$bindir/clupdate-git-repo 
'{$repo['url']}' '$base/$name' '$branch'";
+                               $command = $this->bindir . "/clupdate-git-repo 
'{$repo['url']}' '$base/$name' '$branch'";
                        } elseif ( $repo['type'] === 'wmgerrit' ) {
                                $branch = isset( $repo['branch'] ) ? 
$repo['branch'] : 'master';
-                               $command = "$bindir/clupdate-gerrit-repo 
'{$repo['url']}' '$base/$name' '$branch'";
+                               $command = $this->bindir . 
"/clupdate-gerrit-repo '{$repo['url']}' '$base/$name' '$branch'";
                        } else {
                                throw new RuntimeException( 'Unknown repo rype' 
);
                        }
@@ -68,6 +74,7 @@
        public function commit() {
                $message = 'Localisation updates from 
https://translatewiki.net.';
                $base = $this->meta['basepath'];
+               $gerritCommitted = false;
 
                foreach ( $this->config['repos'] as $name => $repo ) {
                        if ( $repo['type'] === 'git' ) {
@@ -81,6 +88,8 @@
                                $command = "cd $dir; git add .; " .
                                        "git commit -m '$message' || :; " .
                                        'git review -r origin -t L10n';
+
+                               $gerritCommitted = true;
                        } else {
                                throw new RuntimeException( "Unknown repo type" 
);
                        }
@@ -91,6 +100,14 @@
                        $process->setTimeout( 120 );
                        print $process->getOutput();
                }
+
+               // Merge patch sets submitted to Wikimedia's Gerrit.
+               if ( $gerritCommitted ) {
+                       $process = new Process( $this->bindir . 
'/merge-wmgerrit-patches' );
+                       $process->mustRun();
+                       $process->setTimeout( 120 );
+                       print $process->getOutput();
+               }
        }
 }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/282334
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1130d2e01591f2b4d7259350837b7a836f808e0f
Gerrit-PatchSet: 11
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to