Nikerabbit (Code Review)
2017-12-30 10:42:37 UTC
Nikerabbit has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/401054 )
Change subject: [repong] Fix auto-merging of some patches
......................................................................
[repong] Fix auto-merging of some patches
The repo type check was using the last item from the loop, which
does not make sense. Removed the check that is no longer necessary.
Also fixed merge-wmgerrit-patches to fail on errors so that these
things are more apparent.
Change-Id: Id6ef5e7e34159a0eb9195903128e4996cffcacfb
---
M bin/merge-wmgerrit-patches
M repong/repong.php
2 files changed, 12 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/54/401054/1
diff --git a/bin/merge-wmgerrit-patches b/bin/merge-wmgerrit-patches
index 05448f8..fe1d898 100755
--- a/bin/merge-wmgerrit-patches
+++ b/bin/merge-wmgerrit-patches
@@ -1,10 +1,13 @@
#!/bin/bash
-U="l10n-bot"
-GERRIT="$***@gerrit.wikimedia.org -p 29418 gerrit"
-PROJECT="$1"
+set -e
+set -o pipefail
-for i in `ssh $GERRIT query --format=TEXT owner:$U project:$PROJECT status:open | grep ' url:' |cut -d/ -f5 |sort`
-do
- ssh $GERRIT review $i,1 --code-review 2 --verified 2 --submit
-done
+U="l10n-bot"
+GERRIT="$***@gerrit.wikimedia.org -p 29418"
+
+ssh "$GERRIT" gerrit query --format=TEXT "owner:$U" "project:$1" status:open |
+grep ' url:' |
+cut -d/ -f5 |
+sort |
+xargs -I ____ ssh "$GERRIT" gerrit review ____,1 --code-review 2 --verified 2 --submit
diff --git a/repong/repong.php b/repong/repong.php
index 4cc7328..fae3f90 100644
--- a/repong/repong.php
+++ b/repong/repong.php
@@ -425,8 +425,9 @@
// Merge patch sets submitted to Wikimedia's Gerrit.
$mergePattern = $config[ 'auto-merge' ] ?? false;
- if ( $repo['type'] === 'wmgerrit' && $mergePattern ) {
+ if ( $mergePattern ) {
$command = $this->bindir . "/merge-wmgerrit-patches '$mergePattern'";
+ echo $command . "\n";
$mergeProcess = new Process( $command );
$mergeProcess->setTimeout( 600 );
$mergeProcess->mustRun();
--
To view, visit https://gerrit.wikimedia.org/r/401054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6ef5e7e34159a0eb9195903128e4996cffcacfb
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <***@gmail.com>
Change subject: [repong] Fix auto-merging of some patches
......................................................................
[repong] Fix auto-merging of some patches
The repo type check was using the last item from the loop, which
does not make sense. Removed the check that is no longer necessary.
Also fixed merge-wmgerrit-patches to fail on errors so that these
things are more apparent.
Change-Id: Id6ef5e7e34159a0eb9195903128e4996cffcacfb
---
M bin/merge-wmgerrit-patches
M repong/repong.php
2 files changed, 12 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/54/401054/1
diff --git a/bin/merge-wmgerrit-patches b/bin/merge-wmgerrit-patches
index 05448f8..fe1d898 100755
--- a/bin/merge-wmgerrit-patches
+++ b/bin/merge-wmgerrit-patches
@@ -1,10 +1,13 @@
#!/bin/bash
-U="l10n-bot"
-GERRIT="$***@gerrit.wikimedia.org -p 29418 gerrit"
-PROJECT="$1"
+set -e
+set -o pipefail
-for i in `ssh $GERRIT query --format=TEXT owner:$U project:$PROJECT status:open | grep ' url:' |cut -d/ -f5 |sort`
-do
- ssh $GERRIT review $i,1 --code-review 2 --verified 2 --submit
-done
+U="l10n-bot"
+GERRIT="$***@gerrit.wikimedia.org -p 29418"
+
+ssh "$GERRIT" gerrit query --format=TEXT "owner:$U" "project:$1" status:open |
+grep ' url:' |
+cut -d/ -f5 |
+sort |
+xargs -I ____ ssh "$GERRIT" gerrit review ____,1 --code-review 2 --verified 2 --submit
diff --git a/repong/repong.php b/repong/repong.php
index 4cc7328..fae3f90 100644
--- a/repong/repong.php
+++ b/repong/repong.php
@@ -425,8 +425,9 @@
// Merge patch sets submitted to Wikimedia's Gerrit.
$mergePattern = $config[ 'auto-merge' ] ?? false;
- if ( $repo['type'] === 'wmgerrit' && $mergePattern ) {
+ if ( $mergePattern ) {
$command = $this->bindir . "/merge-wmgerrit-patches '$mergePattern'";
+ echo $command . "\n";
$mergeProcess = new Process( $command );
$mergeProcess->setTimeout( 600 );
$mergeProcess->mustRun();
--
To view, visit https://gerrit.wikimedia.org/r/401054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6ef5e7e34159a0eb9195903128e4996cffcacfb
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <***@gmail.com>