/[scripts]/trunk/svn-rt-comment.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/svn-rt-comment.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (show annotations)
Thu Oct 23 21:45:59 2008 UTC (15 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 1173 byte(s)
- relaxed RT regex to make # optional
- better formatting of message attached to RT

1 #!/usr/bin/perl
2
3 # http://blog.rot13.org/2008/09/request_tracker_subversion_svnweb_microblogging.html
4
5 use strict;
6 use warnings;
7
8 use RT::Client::REST;
9 use RT::Client::REST::Ticket;
10
11 # Request Tracker
12 my ( $server, $username, $password ) = ( 'https://bugs.example.com/rt', 'rtuser', 'rtpasswd' );
13 # patternt to recognize RT references in commits log or diff
14 my $rt_re = qr/rt\s*#?\s*(\d+)/i;
15 my $svnweb = 'https://svn.example.com/svnweb/index.cgi/strix/revision/?rev=';
16
17 die "usage: $0 repo rev\n" unless @ARGV;
18
19 my ( $repo, $rev ) = @ARGV;
20
21 sub svnlook {
22 my $command = shift;
23 my $txt = `svnlook $command --revision $rev $repo`;
24 chomp( $txt );
25 return $txt;
26 }
27
28 my $log = svnlook 'log';
29 my $diff = svnlook 'diff';
30
31 if ( $log =~ $rt_re || $diff =~ $rt_re ) {
32
33 my $id = $1 or die "no id";
34
35 my $rt = RT::Client::REST->new( server => $server );
36 $rt->login( username => $username, password => $password );
37 my $ticket = RT::Client::REST::Ticket->new( rt => $rt, id => $id );
38
39 my $message =
40 $svnweb . $rev . "\n" .
41 svnlook('author') . "\t" . svnlook('date') . "\n\n" .
42 svnlook('changed --copy-info') . "\n\n" .
43 $log
44 ;
45
46 $ticket->comment( message => $message );
47 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26