r77953 - /scripts/git-tag-pending-bugs

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu Jul 28 13:36:42 UTC 2011


Author: dmn
Date: Thu Jul 28 13:36:40 2011
New Revision: 77953

URL: http://svn.debian.org/wsvn/?sc=1&rev=77953
Log:
first take at tag-pending-buga for git

Added:
    scripts/git-tag-pending-bugs   (with props)

Added: scripts/git-tag-pending-bugs
URL: http://svn.debian.org/wsvn/scripts/git-tag-pending-bugs?rev=77953&op=file
==============================================================================
--- scripts/git-tag-pending-bugs (added)
+++ scripts/git-tag-pending-bugs Thu Jul 28 13:36:40 2011
@@ -1,0 +1,78 @@
+#!/usr/bin/perl -w
+
+# Find bugs closed by this commit and tag them pending in the BTS
+#
+# Synopsis: $0 repos_path revision
+#
+# Copyright © 2008, 2011 Damyan Ivanov <dmn at debian.org>
+#
+# This program is free software. You may distribute it under
+# the terms of Perl
+
+use strict;
+use Git;
+use Mail::Send;
+use File::Basename qw(basename);
+use Sys::Hostname::Long;
+
+use constant FROM	=> 'pkg-perl-maintainers at lists.alioth.debian.org';
+
+my( $repo_path, $revision ) = @ARGV;
+
+my $git = Git->repository($repo_path);
+my ( $package, $author, $log );
+
+$package = basename($repo_path);
+$package =~ s/\.git$//;
+
+for my $line ( $git->command( show => $revision ) ) {
+    if ( defined($log) ) {
+        $log .= "\n" if $log ne '';
+        $log .= $line;
+        next;
+    }
+
+    $log = '', next if $line eq '';
+
+    $author = $1 if $line =~ /^Author: (.+) </;
+}
+
+my @bugs;
+my $log_copy = $log;
+while( $log_copy =~ s/(closes:\s*(?:bug)?\#\s*\d+(?:,\s*(?:bug)?\#\s*\d+)*)//is )
+{
+  my $match = $1;
+  push @bugs, $1 while $match =~ s/#(\d+)//;
+}
+
+exit unless @bugs;
+
+my $msg = Mail::Send->new(
+  Subject=>"Bug in $package fixed in revision $revision",
+  Bcc	=> 'control at bugs.debian.org',
+);
+$msg->add('From', FROM);
+$msg->add('X-Mailer', (basename $0).' running on '.hostname_long);
+$msg->add('X-Debbugs-No-Ack', 'please');
+$msg->add('X-Git-Repository', $repo_path);
+$msg->add('X-Debian', (basename $0));
+$msg->add('X-Debian-Package', $package);
+$msg->add('MIME-Version', '1.0');
+$msg->add('Content-Type', 'text/plain; charset=utf-8');     
+$msg->add('Content-Transfer-Encoding', '8bit');
+
+$msg->to(
+    join(
+        ', ',
+        map(
+            ("$_\@bugs.debian.org", "$_-submitter\@bugs.debian.org"),
+            @bugs )
+    )
+);
+
+my $out = $msg->open();
+$out->print("tag $_ + pending\n") foreach @bugs;
+$out->print("thanks\n\n");
+$out->print("Some bugs are closed in revision $revision\nby $author\n\n");
+$out->print("Commit message:\n\n$log\n");
+$out->close;

Propchange: scripts/git-tag-pending-bugs
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pkg-perl-cvs-commits mailing list