From 4a7888b812104d5d92f74091264c5857c7ec6889 Mon Sep 17 00:00:00 2001
From: Andreas Jaeger <aj@suse.de>
Date: Fri, 23 Oct 2015 08:14:48 +0200
Subject: [PATCH] Handle "No changes" in translation scripts

Some translation proposal jobs currently fail since there are no changes
since the previous run like
https://jenkins.openstack.org/job/django_openstack_auth-propose-translation-update/32/console

Handle the situation to easily figure out real failures.

Change-Id: I1f1dc9b73578ee95e5a964c30313fe0421dbf90a
---
 jenkins/scripts/common_translation_update.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh
index 93e135b5ab..39d8cbbaeb 100644
--- a/jenkins/scripts/common_translation_update.sh
+++ b/jenkins/scripts/common_translation_update.sh
@@ -193,6 +193,9 @@ EOF
 # Propose patch using COMMIT_MSG
 function send_patch {
     local branch=${1:-master}
+    local output
+    local ret
+    local success=0
 
     # We don't have any repos storing zanata.xml, so just remove it.
     rm -f zanata.xml
@@ -203,11 +206,17 @@ function send_patch {
         git commit -F- <<EOF
 $COMMIT_MSG
 EOF
+        # Do error checking manually to ignore one class of failure.
+        set +e
         # We cannot rely on the default branch in .gitreview being
         # correct so we are very explicit here.
-        git review -t zanata/translations $branch
-
+        output=$(git review -t zanata/translations $branch)
+        ret=$?
+        [[ "$ret" -eq "0" || "$output" =~ "No changes between prior commit" ]]
+        success=$?
+        set -e
     fi
+    return $success
 }
 
 # Setup global variables LEVELS and LKEYWORDS