Parent Directory | Revision Log
If subversion commit messages carry magic marker (RT #1234 in my case) I want to create RT comment (micro-blog post) with link back to SVN::Web repository (and thus commit which created comment in first place). Nice and circular :-)
1 | dpavlin | 90 | #!/usr/bin/perl |
2 | |||
3 | # https://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 | `svnlook $command --revision $rev $repo` | ||
24 | } | ||
25 | |||
26 | my $log = svnlook 'log'; | ||
27 | my $diff = svnlook 'diff'; | ||
28 | |||
29 | if ( $log =~ $rt_re || $diff =~ $rt_re ) { | ||
30 | |||
31 | my $id = $1 or die "no id"; | ||
32 | |||
33 | my $rt = RT::Client::REST->new( server => $server ); | ||
34 | $rt->login( username => $username, password => $password ); | ||
35 | my $ticket = RT::Client::REST::Ticket->new( rt => $rt, id => $id ); | ||
36 | |||
37 | my $message = | ||
38 | svnlook 'author' . "\t" . svnlook 'date' . "\n" . | ||
39 | $svnweb . $rev . "\n\n" . | ||
40 | svnlook 'changed --copy-info' . "\n" . | ||
41 | $log | ||
42 | ; | ||
43 | |||
44 | $ticket->comment( message => $message ); | ||
45 | } |
Name | Value |
---|---|
svn:executable | * |
ViewVC Help | |
Powered by ViewVC 1.1.26 |