11 |
# Request Tracker |
# Request Tracker |
12 |
my ( $server, $username, $password ) = ( 'https://bugs.example.com/rt', 'rtuser', 'rtpasswd' ); |
my ( $server, $username, $password ) = ( 'https://bugs.example.com/rt', 'rtuser', 'rtpasswd' ); |
13 |
# patternt to recognize RT references in commits log or diff |
# patternt to recognize RT references in commits log or diff |
14 |
my $rt_re = qr/rt\s*#\s*(\d+)/i; |
my $rt_re = qr/\brt\s*#?\s*(\d+)\b/i; |
15 |
my $svnweb = 'https://svn.example.com/svnweb/index.cgi/strix/revision/?rev='; |
my $svnweb_fmt = 'http://svn.example.com/svnweb/index.cgi/%s/revision/?rev=%d'; |
16 |
|
|
17 |
die "usage: $0 repo rev\n" unless @ARGV; |
die "usage: $0 repo rev\n" unless @ARGV; |
18 |
|
|
20 |
|
|
21 |
sub svnlook { |
sub svnlook { |
22 |
my $command = shift; |
my $command = shift; |
23 |
`svnlook $command --revision $rev $repo` |
my $txt = `svnlook $command --revision $rev $repo`; |
24 |
|
chomp( $txt ); |
25 |
|
return $txt; |
26 |
} |
} |
27 |
|
|
28 |
my $log = svnlook 'log'; |
my $log = svnlook 'log'; |
36 |
$rt->login( username => $username, password => $password ); |
$rt->login( username => $username, password => $password ); |
37 |
my $ticket = RT::Client::REST::Ticket->new( rt => $rt, id => $id ); |
my $ticket = RT::Client::REST::Ticket->new( rt => $rt, id => $id ); |
38 |
|
|
39 |
|
my $repo_only = $repo; |
40 |
|
$repo_only =~ s{^.*/([^/]+)$}{$1}; |
41 |
|
|
42 |
my $message = |
my $message = |
43 |
svnlook 'author' . "\t" . svnlook 'date' . "\n" . |
sprintf($svnweb_fmt,$repo_only, $rev) . "\n" . |
44 |
$svnweb . $rev . "\n\n" . |
svnlook('author') . "\t" . svnlook('date') . "\n\n" . |
45 |
svnlook 'changed --copy-info' . "\n" . |
svnlook('changed --copy-info') . "\n\n" . |
46 |
$log |
$log |
47 |
; |
; |
48 |
|
|
49 |
$ticket->comment( message => $message ); |
$ticket->comment( message => $message ); |
50 |
} |
} |