[Libreoffice] [PATCH] run-libreoffice-ciabot: avoid flood on merges

Miklos Vajna vmiklos at frugalware.org
Thu Nov 25 16:33:05 PST 2010


Hi Kendy,

I'm attaching a patch that updates the cia bot so that you don't need to
manually disable it on each merge. ;)

OK to push? (More importantly, if I push it, it would be nice if you
could restart the bot, as I guess that's not automatic. :) )

Thanks.
-------------- next part --------------
From 53a5563a0b4df6a45d73bc80be6927b06556e573 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos at frugalware.org>
Date: Fri, 26 Nov 2010 01:27:46 +0100
Subject: [PATCH] run-libreoffice-ciabot: avoid flood on merges

Check if the last hash is a merge commit: if yes, then just announce the
last one, otherwise do the usual "announce any commit since the last
one" dance.
---
 scratch/cia/run-libreoffice-ciabot.pl |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/scratch/cia/run-libreoffice-ciabot.pl b/scratch/cia/run-libreoffice-ciabot.pl
index bc8c0aa..0c6f892 100644
--- a/scratch/cia/run-libreoffice-ciabot.pl
+++ b/scratch/cia/run-libreoffice-ciabot.pl
@@ -44,16 +44,24 @@ sub report($$$) {
 
         if ( defined( $old_head ) ) {
             if ( $old_head ne $new_head ) {
-                if ( open COMMITS, "git rev-list $new_head ^$old_head | tac |" ) {
-                    while ( <COMMITS> ) {
-                        chomp;
-                        print "Sending report about $_ in $key\n";
-                        qx(libreoffice-ciabot.pl $repo $_ $branch_name)
+                my $ret = system("git rev-parse -q --verify $new_head^2 >/dev/null");
+                if ($ret != 0) {
+                    # not a merge commit, announce every commit
+                    if ( open COMMITS, "git rev-list $new_head ^$old_head | tac |" ) {
+                        while ( <COMMITS> ) {
+                            chomp;
+                            print "Sending report about $_ in $key\n";
+                            qx(libreoffice-ciabot.pl $repo $_ $branch_name)
+                        }
+                        close COMMITS;
                     }
-                    close COMMITS;
-                }
-                else {
-                    error( "Cannot call git rev-list." );
+                    else {
+                        error( "Cannot call git rev-list." );
+                    }
+                } else {
+                    # just process the merge commit itself
+                    print "Sending report about $new_head in $key\n";
+                    qx(libreoffice-ciabot.pl $repo $new_head $branch_name)
                 }
             }
         }
-- 
1.7.3.2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101126/d883e340/attachment.pgp>


More information about the LibreOffice mailing list