SVN-Notify
view release on metacpan or search on metacpan
- Modified the RT link regular expression pattern so that it
matches strings like "RT-Ticket: 23" as well as "Ticket 1234".
Suggested by Jesse Vincent.
- Added complicated example to try to show off all of the major
features. I will keep this up-to-date going forward in order to
post sample output on the Web.
- Fixed the parsing of log messages so that empty lines are no
longer eliminated.
- HTML::ColorDiff now properly handles the listing of binary files
in the diff, marking them with a new class, "binary", and using
the same CSS as is used for the "propset" class.
- In HTML::ColorDiff, Fixed CSS for the "delfile" class to properly
wrap it in a border like the other files in the diff.
- Added labels to the HTML::ColorDiff diff file sections to indicate
the type of change ("Modified", "Added", "Deleted", or "Property
changes").
- Moved the "rt_url", "bugzilla_url", and "jira_url" parameters from
SVN::Notify::HTML to SVN::Notify, where they are used to add URLs
to the text version of log messages.
2.30 2004-10-19T05:20:02
lib/SVN/Notify/HTML/ColorDiff.pm view on Meta::CPAN
} elsif ($line =~ /^Property changes on: (.*)/ && !$seen{$1}) {
# It's just property changes.
my $file = encode_entities($1, '<>&"');
(my $id = $file) =~ s/[^\w_]//g;
# Dump line.
<$diff>;
# Output the headers.
print $out "</$in_span>" if $in_span;
print $out "</span></pre></div>\n" if $in_div;
print $out qq{<a id="$id"></a>\n<div class="propset">},
qq{<h4>Property changes: $file</h4>\n<pre class="diff"><span>\n};
$in_div = 1;
$in_span = '';
} elsif ($line =~ /^\@\@/) {
print $out "</$in_span>" if $in_span;
print $out (
qq{<span class="lines">},
encode_entities($line, '<>&"'),
"\n</span>",
);
lib/SVN/Notify/HTML/ColorDiff.pm view on Meta::CPAN
}
##############################################################################
sub _css {
my $css = shift->SUPER::_css;
push @$css,
qq(#patch h4 {font-family: verdana,arial,helvetica,sans-serif;),
qq(font-size:10pt;padding:8px;background:#369;color:#fff;),
qq(margin:0;}\n),
qq(#patch .propset h4, #patch .binary h4 {margin:0;}\n),
qq(#patch pre {padding:0;line-height:1.2em;margin:0;}\n),
qq(#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;),
qq(overflow:auto;}\n),
qq(#patch .propset .diff, #patch .binary .diff {padding:10px 0;}\n),
qq(#patch span {display:block;padding:0 10px;}\n),
qq(#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, ),
qq(#patch .binary, #patch .copfile {border:1px solid #ccc;),
qq(margin:10px 0;}\n),
qq(#patch ins {background:#dfd;text-decoration:none;display:block;),
qq(padding:0 10px;}\n),
qq(#patch del {background:#fdd;text-decoration:none;display:block;),
qq(padding:0 10px;}\n),
qq(#patch .lines, .info {color:#888;background:#fff;}\n);
return $css;
}
isa_ok($notifier, 'SVN::Notify');
ok( $notifier->prepare, "Prepare encoding" );
ok( $notifier->execute, "Notify encoding" );
# Check the output.
$email = get_output();
like( $email, qr{Content-Type: text/html; charset=ISO-8859-1\n},
'Check Content-Type charset' );
##############################################################################
# Try html format with propsets.
##############################################################################
ok( $notifier = SVN::Notify::HTML->new(%args, with_diff => 1, revision => '333'),
"Construct new HTML propset notifier" );
isa_ok($notifier, 'SVN::Notify::HTML');
isa_ok($notifier, 'SVN::Notify');
ok( $notifier->prepare, "Prepare HTML propset" );
ok( $notifier->execute, "Notify HTML propset" );
# Check the output.
$email = get_output();
like( $email, qr{Subject: \[333\] Property modification\.\n},
"Check subject header for propset HTML" );
like( $email, qr/From: theory\n/, 'Check HTML propset From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML propset To');
like( $email, qr{Content-Type: text/html; charset=UTF-8\n},
'Check HTML propset Content-Type' );
like( $email, qr{Content-Transfer-Encoding: 8bit\n},
'Check HTML propset Content-Transfer-Encoding');
like( $email,
qr|<a id="trunkactivitymailbinactivitymail">Modified: trunk/activitymail/bin/activitymail</a>\n|,
"Check for file name anchor id" );
like( $email,
qr|<a id="trunkactivitymailtactivitymailt">Property changes on: trunk/activitymail/t/activitymail\.t</a>\n|,
"Check for propset file name anchor id" );
##############################################################################
# Try linkize and Bug tracking URLs.
##############################################################################
ok( $notifier = SVN::Notify::HTML->new(
%args,
revision => 222,
viewcvs_url => 'http://viewsvn.bricolage.cc/?rev=%s&view=rev',
rt_url => 'http://rt.cpan.org/NoAuth/Bugs.html?id=%s',
bugzilla_url => 'http://bugzilla.mozilla.org/show_bug.cgi?id=%s',
t/htmlcolordiff.t view on Meta::CPAN
isa_ok($notifier, 'SVN::Notify');
ok( $notifier->prepare, "Prepare encoding" );
ok( $notifier->execute, "Notify encoding" );
# Check the output.
$email = get_output();
like( $email, qr{Content-Type: text/html; charset=ISO-8859-1\n},
'Check Content-Type charset' );
##############################################################################
# Try html format with propsets.
##############################################################################
ok( $notifier = SVN::Notify::HTML::ColorDiff->new(%args, with_diff => 1,
revision => '333'),
"Construct new propset notifier" );
isa_ok($notifier, 'SVN::Notify::HTML::ColorDiff');
isa_ok($notifier, 'SVN::Notify::HTML');
isa_ok($notifier, 'SVN::Notify');
ok( $notifier->prepare, "Prepare propset HTML file" );
ok( $notifier->execute, "Notify propset HTML file" );
# Check the output.
$email = get_output();
like( $email, qr{Subject: \[333\] Property modification\.\n},
"Check subject header for propset HTML" );
like( $email, qr/From: theory\n/, 'Check propset HTML From');
like( $email, qr/To: test\@example\.com\n/, 'Check propset HTML To');
like( $email, qr{Content-Type: text/html; charset=UTF-8\n},
'Check propset HTML Content-Type' );
like( $email, qr{Content-Transfer-Encoding: 8bit\n},
'Check propset HTML Content-Transfer-Encoding');
# Check for a header for the modified file.
like( $email, qr{<a id="trunkactivitymailbinactivitymail"></a>\n},
"Check for modified file div ID");
like( $email, qr{<div class="modfile"><h4>Modified: trunk/activitymail/bin/activitymail \(681 => 682\)</h4>},
"Check for modified file header" );
# Check for propset file.
like( $email, qr{<a id="trunkactivitymailbinactivitymail"></a>\n},
"Check for modified file div ID");
like( $email, qr{<div class="propset"><h4>Property changes: trunk/activitymail/t/activitymail\.t</h4>},
"Check for modified file header" );
##############################################################################
# SVNWeb URL.
##############################################################################
ok( $notifier = SVN::Notify::HTML::ColorDiff->new(
%args,
revision => 444,
svnweb_url => 'http://svn.example.com/index.cgi/revision/?rev=%s',
),
( run in 2.199 seconds using v1.01-cache-2.11-cpan-71847e10f99 )