Daniel Ribeiro : git-notify: Add an option to notify only about specified branches.

Alexandre Julliard julliard at winehq.org
Tue Jul 7 07:01:07 CDT 2009


Module: tools
Branch: master
Commit: b87fdcc46989cbc27541e5d610066b7ee95fb752
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=b87fdcc46989cbc27541e5d610066b7ee95fb752

Author: Daniel Ribeiro <drwyrm at gmail.com>
Date:   Mon Jul  6 15:22:45 2009 +0200

git-notify: Add an option to notify only about specified branches.

To add more than one branch to the include list, issue more than one
"-i branch" arguments, one for each branch.

When at least one "-i branch" is used, the -x option will be ignored.

---

 git-notify |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/git-notify b/git-notify
index 50345b1..8c3d523 100755
--- a/git-notify
+++ b/git-notify
@@ -20,6 +20,7 @@
 #   -r name   Set the git repository name
 #   -s bytes  Set the maximum diff size in bytes (-1 for no limit)
 #   -u url    Set the URL to the gitweb browser
+#   -i branch If at least one -i is given, report only for specified branches
 #   -x branch Exclude changes to the specified branch from reports
 #
 
@@ -65,6 +66,9 @@ my $cia_project_name = git_config( "notify.cia" );
 # max number of individual notices before falling back to a single global notice (can be set with -n option)
 my $max_individual_notices = git_config( "notify.maxnotices" ) || 100;
 
+# branches to include
+my @include_list = split /\s+/, git_config( "notify.include" ) || "";
+
 # branches to exclude
 my @exclude_list = split /\s+/, git_config( "notify.exclude" ) || "";
 
@@ -77,6 +81,7 @@ sub usage()
     print "   -r name   Set the git repository name\n";
     print "   -s bytes  Set the maximum diff size in bytes (-1 for no limit)\n";
     print "   -u url    Set the URL to the gitweb browser\n";
+    print "   -i branch If at least one -i is given, report only for specified branches\n";
     print "   -x branch Exclude changes to the specified branch from reports\n";
     exit 1;
 }
@@ -137,6 +142,7 @@ sub parse_options()
         elsif ($arg eq '-r') { $repos_name = shift @ARGV; }
         elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
         elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; }
+        elsif ($arg eq '-i') { push @include_list, shift @ARGV; }
         elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; }
         elsif ($arg eq '-d') { $debug++; }
         else { usage(); }
@@ -365,6 +371,8 @@ sub send_all_notices($$$)
 
     $ref =~ s/^refs\/heads\///;
 
+    return if (@include_list && !grep {$_ eq $ref} @include_list);
+
     if ($old_sha1 eq '0' x 40)  # new ref
     {
         send_commit_notice( $ref, $new_sha1 ) if $commitlist_address;




More information about the wine-cvs mailing list