line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVN::Notify::Filter::Trac; |
2
|
|
|
|
|
|
|
|
3
|
39
|
|
|
39
|
|
267
|
use strict; |
|
39
|
|
|
|
|
40
|
|
|
39
|
|
|
|
|
949
|
|
4
|
39
|
|
|
39
|
|
193
|
use Text::Trac; |
|
39
|
|
|
|
|
45
|
|
|
39
|
|
|
|
|
311
|
|
5
|
39
|
|
|
39
|
|
996
|
use SVN::Notify; |
|
39
|
|
|
|
|
79
|
|
|
39
|
|
|
|
|
568
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$SVN::Notify::Filter::Trac::VERSION = '2.87'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=begin comment |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Fake out Test::Pod::Coverage. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head3 log_message |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head3 css |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=end comment |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
SVN::Notify->register_attributes( trac_url => 'trac-url=s' ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub log_message { |
24
|
63
|
|
|
63
|
1
|
790
|
my ($notify, $lines) = @_; |
25
|
63
|
100
|
|
|
|
1107
|
return $lines unless $notify->content_type eq 'text/html'; |
26
|
31
|
|
|
|
|
1440
|
my $trac = Text::Trac->new( trac_url => $notify->trac_url ); |
27
|
31
|
|
|
|
|
2558
|
my $msg = join $/, @{ $lines }; |
|
31
|
|
|
|
|
300
|
|
28
|
31
|
|
|
|
|
457
|
$msg =~ s/^\n+//g; |
29
|
31
|
|
|
|
|
457
|
$msg =~ s/\n+$//g; |
30
|
31
|
|
|
|
|
907
|
return [ $trac->parse( $msg ) ]; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub css { |
34
|
31
|
|
|
31
|
1
|
630
|
my ($notify, $css)= @_; |
35
|
31
|
50
|
|
|
|
434
|
return $css unless $notify->content_type eq 'text/html'; |
36
|
31
|
|
|
|
|
602
|
push @$css, ( |
37
|
|
|
|
|
|
|
qq(#logmsg blockquote.citation { padding: 0; border: 0; border-left: solid 2px #b44; padding-left: .75em; background: transparent; }\n), |
38
|
|
|
|
|
|
|
qq(#logmsg blockquote.citation .citation { border-color: #4b4; }\n), |
39
|
|
|
|
|
|
|
qq(#logmsg blockquote.citation .citation .citation { border-color: #44b; }\n), |
40
|
|
|
|
|
|
|
qq(#logmsg blockquote.citation .citation .citation .citation { border-color: #c55; }\n), |
41
|
|
|
|
|
|
|
qq(#logmsg ol.loweralpha { list-style-type: lower-alpha; }\n), |
42
|
|
|
|
|
|
|
qq(#logmsg ol.upperalpha { list-style-type: upper-alpha; }\n), |
43
|
|
|
|
|
|
|
qq(#logmsg ol.lowerroman { list-style-type: lower-roman; }\n), |
44
|
|
|
|
|
|
|
qq(#logmsg ol.upperroman { list-style-type: upper-roman; }\n), |
45
|
|
|
|
|
|
|
qq(#logmsg ol.arabic { list-style-type: decimal; }\n), |
46
|
|
|
|
|
|
|
); |
47
|
31
|
|
|
|
|
289
|
return $css; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 Name |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
SVN::Notify::Filter::Trac - Filter SVN::Notify output in Trac format |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 Synopsis |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Use F in F: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
svnnotify --p "$1" --r "$2" --to you@example.com --handler HTML \ |
61
|
|
|
|
|
|
|
--filter Trac --trac-url http://trac.example.com |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Use the class in a custom script: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use SVN::Notify; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $notifier = SVN::Notify->new( |
68
|
|
|
|
|
|
|
repos_path => $path, |
69
|
|
|
|
|
|
|
revision => $rev, |
70
|
|
|
|
|
|
|
to => 'you@example.com', |
71
|
|
|
|
|
|
|
handler => 'HTML::ColorDiff', |
72
|
|
|
|
|
|
|
filters => [ 'Trac' ], |
73
|
|
|
|
|
|
|
trac_url => 'http://trac.example.com/', |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
$notifier->prepare; |
76
|
|
|
|
|
|
|
$notifier->execute; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 Description |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This module filters SVN::Notify log message output from Trac markup into HTML. |
81
|
|
|
|
|
|
|
Essentially, this means that if you write your commit log messages using Trac |
82
|
|
|
|
|
|
|
wiki markup and like to use L or |
83
|
|
|
|
|
|
|
L to format your |
84
|
|
|
|
|
|
|
commit notifications, you can use this filter to convert the Trac formatting |
85
|
|
|
|
|
|
|
in the log message to HTML. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
If you specify an extra argument, C (or the C<--trac-url> parameter |
88
|
|
|
|
|
|
|
to C), it will be used to generate Trac links for revision numbers |
89
|
|
|
|
|
|
|
and the like in your log messages. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 See Also |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item L |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=back |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 Author |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
David E. Wheeler |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 Copyright and License |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright (c) 2008-2016 David E. Wheeler. Some Rights Reserved. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
110
|
|
|
|
|
|
|
the same terms as Perl itself. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |