[Libreoffice-commits] dev-tools.git: Branch 'private/jmux/filter-bugzilla-branches' - ciabot/run-libreoffice-ciabot.pl

Jan-Marek Glogowski glogow at fbihome.de
Fri Mar 14 03:29:54 PDT 2014


Rebased ref, commits from common ancestor:
commit ea5d93ba9a99f50c4771844ca3e58c3ce372c4d2
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Mon Mar 3 14:20:28 2014 +0000

    Filter branches for automatic bugzilla reports.
    
    Introduces a much stricter branch filter for the 'core' repository.
    Now it just reports changes for libreoffice-[^/]* and master.

diff --git a/ciabot/run-libreoffice-ciabot.pl b/ciabot/run-libreoffice-ciabot.pl
index 689cb36..4cb1bdb 100755
--- a/ciabot/run-libreoffice-ciabot.pl
+++ b/ciabot/run-libreoffice-ciabot.pl
@@ -24,6 +24,13 @@ sub error($) {
     print STDERR "$message\n";
 }
 
+#
+# Get a list of filtered branch HEADs
+#
+# Gets all branches, except HEAD.
+#
+# @returns \%{ branch name => git branch head hashval }
+#
 sub get_branches() {
     my %branches;
     if ( open REFS, "git show-ref |" ) {
@@ -44,10 +51,34 @@ sub get_branches() {
     return \%branches;
 }
 
+#
+# Should we generate Bugzilla comments?
+#
+# Report all commits for all repositories except 'core'. For 'core'
+# just report libreoffice-* and master branches to Bugzilla.
+#
+# @returns true, if this commit should be reported to Bugzilla.
+#
+sub is_valid_bugzilla_commit($$) {
+   my ( $repo, $branch ) = @_;
+   return 1 if ( $repo ne 'core' );
+   return ( $branch =~ /^(libreoffice-[^\/]*|master)$/ );
+}
+
 sub timestamp() {
         return strftime("[%Y-%m-%d %H:%M:%S]", localtime);
 }
 
+#
+# Report all branch changes to IRC and bugzilla.
+#
+# We just report changes filtered by is_valid_bugzilla_report to Bugzilla
+# but inform IRC off all changes.
+#
+# $1 = repository name
+# $2 = hashref of old branch heads (@see get_branches).
+# $3 = hashref of new branch heads (@see get_branches).
+#
 sub report($$$) {
     my ( $repo, $old_ref, $new_ref ) = @_;
     my %old = %{$old_ref};
@@ -88,10 +119,12 @@ sub report($$$) {
                                     qx(perl -I $cwd $cwd/sigui-bugzilla.pl $repo $_ $branch_name);
                                 } else {
                                     qx($ciabot $repo $_ $branch_name $ciaproxy);
+                                    next if ( ! is_valid_bugzilla_commit( $repo, $branch_name ) );
                                     qx(perl -I $cwd $cwd/libreoffice-bugzilla.pl $repo $_ $branch_name);
                                 }
                             } else {
                                 print "$ciabot '$repo' '$_' '$branch_name' $ciaproxy\n";
+                                next if ( ! is_valid_bugzilla_commit( $repo, $branch_name ) );
                                 print "perl -I $cwd $cwd/libreoffice-bugzilla.pl '$repo' '$_' '$branch_name'\n";
                             }
                         }


More information about the Libreoffice-commits mailing list