Diff
trunk/SVN-Notify/Changes (739 => 740)
--- trunk/SVN-Notify/Changes 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/Changes 2004-10-15 06:12:54 UTC (rev 740)
@@ -3,6 +3,12 @@
2.22
- Fixed diff parsing in SVN::Notitfy::HTML and
SVN::Notitfy::HTML::ColoDiff to recognize added and deleted files.
+ - Added links to files for which properties were set down into
+ their place in the diff in SVN::Notitfy::HTML and
+ SVN::Notitfy::HTML::ColoDiff.
+ - Changed the class for each file in the diff output by
+ SVN::Notitfy::HTML::ColoDiff to be specific to whether the file
+ was modified, added, deleted, or just had its properties set.
2.21 2004-10-09T22:37:34
- Tweaked HTML to make it all XHTML 1.1 compliant.
trunk/SVN-Notify/MANIFEST (739 => 740)
--- trunk/SVN-Notify/MANIFEST 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/MANIFEST 2004-10-15 06:12:54 UTC (rev 740)
@@ -15,11 +15,15 @@
t/bin/testsvnlook.bat
t/data/changed/111.txt
t/data/changed/222.txt
+t/data/changed/333.txt
t/data/diff/111.txt
+t/data/diff/333.txt
t/data/dirs-changed/111.txt
t/data/dirs-changed/222.txt
+t/data/dirs-changed/333.txt
t/data/info/111.txt
t/data/info/222.txt
+t/data/info/333.txt
t/errors.t
t/html.t
t/htmlcolordiff.t
trunk/SVN-Notify/lib/SVN/Notify/HTML/ColorDiff.pm (739 => 740)
--- trunk/SVN-Notify/lib/SVN/Notify/HTML/ColorDiff.pm 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/lib/SVN/Notify/HTML/ColorDiff.pm 2004-10-15 06:12:54 UTC (rev 740)
@@ -63,14 +63,17 @@
my ($self, $out) = @_;
$self->SUPER::output_css($out);
print $out
- qq(#patch .file h3 {padding: 0 10px;line-height:1.5em;),
+ qq(#patch h4 {padding: 0 10px;line-height:1.5em;),
qq(margin:0;background:#ccffff;border-bottom:1px solid black;),
qq(margin:0 0 10px 0;}\n),
+ qq(#patch .propset h4 {margin: 0;}\n),
qq(#patch pre {padding:0;line-height:1.2em;),
qq(margin:0;}\n),
qq(#patch .diff {background:#eeeeee;padding: 0 0 10px 0;}\n),
+ qq(#patch .propset .diff {padding: 10px 0;}\n),
qq(#patch span {display:block;padding:0 10px;}\n),
- qq(#patch .file {border:1px solid black;margin:10px 0;}\n),
+ qq(#patch .modfile, #patch .addfile, #patch .addfile, #patch .propset),
+ qq({border:1px solid black;margin:10px 0;}\n),
qq(#patch .add {background:#ddffdd;}\n),
qq(#patch .rem {background:#ffdddd;}\n),
qq(#patch .lines, .info {color:#888888;background:#ffffff;}\n);
@@ -90,6 +93,12 @@
=cut
+my %types = (
+ Modified => 'modfile',
+ Added => 'addfile',
+ Deleted => 'delfile',
+);
+
sub output_diff {
my ($self, $out, $diff) = @_;
$self->_dbpnt( "Outputting colorized HTML diff") if $self->verbose > 1;
@@ -97,11 +106,13 @@
my $in_div;
my $in_span = '';
print $out qq{</div>\n<div id="patch">\n<h3>Diff</h3>\n};
+ my %seen;
while (my $line = <$diff>) {
$line =~ s/[\n\r]+$//;
next unless $line;
- if ($line =~ /^(?:Modified|Added|Deleted): (.*)/) {
- my $file = encode_entities($1);
+ if ($line =~ /^(Modified|Added|Deleted): (.*)/) {
+ my $class = $types{$1};
+ my $file = encode_entities($2);
(my $id = $file) =~ s/[^\w_]//g;
# Dump line.
<$diff>;
@@ -117,13 +128,27 @@
# Output the headers.
print $out "</span>" if $in_span;
print $out "</pre></div>\n" if $in_div;
- print $out qq{<a id="$id"></a>\n<div class="file"><h3>$file},
- " ($rev1 => $rev2)</h3>\n";
+ print $out qq{<a id="$id"></a>\n<div class="$class"><h4>$file},
+ " ($rev1 => $rev2)</h4>\n";
print $out qq{<pre class="diff">\n<span class="info">};
$in_div = 1;
print $out encode_entities($_), "\n" for ($before, $after);
print $out "</span>";
$in_span = '';
+ } 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 "</span>" if $in_span;
+ print $out "</pre></div>\n" if $in_div;
+ print $out qq{<a id="$id"></a>\n<div class="propset"><h4>$file</h4>\n};
+ print $out qq{<pre class="diff">\n};
+ $in_div = 1;
+ $in_span = '';
} elsif ($line =~ /^\@\@/) {
print $out "</span>" if $in_span;
print $out qq{<span class="lines">}, encode_entities($line),
trunk/SVN-Notify/lib/SVN/Notify/HTML.pm (739 => 740)
--- trunk/SVN-Notify/lib/SVN/Notify/HTML.pm 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/lib/SVN/Notify/HTML.pm 2004-10-15 06:12:54 UTC (rev 740)
@@ -201,7 +201,7 @@
# Identify the action and output each file.
print $out "<h3>$map->{$type}</h3>\n<ul>\n";
- if ($self->with_diff && !$self->attach_diff && $type ne '_') {
+ if ($self->with_diff && !$self->attach_diff) {
for (@{ $files->{$type} }) {
my $file = encode_entities($_);
# Strip out letters illegal for IDs.
@@ -255,9 +255,12 @@
$self->_dbpnt( "Outputting HTML diff") if $self->verbose > 1;
print $out qq{</div>\n<div id="patch"><pre>\n};
+ my %seen;
while (<$diff>) {
s/[\n\r]+$//;
- if (/^(Modified|Added|Deleted): (.*)/) {
+ if (/^(Modified|Added|Deleted|Property changes on): (.*)/
+ && !$seen{$2}++)
+ {
my $action = $1;
my $file = encode_entities($2);
(my $id = $file) =~ s/[^\w_]//g;
trunk/SVN-Notify/t/data/changed/111.txt (739 => 740)
--- trunk/SVN-Notify/t/data/changed/111.txt 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/data/changed/111.txt 2004-10-15 06:12:54 UTC (rev 740)
@@ -13,7 +13,7 @@
_U trunk/Class-Meta/lib/Class/Meta/Types/Numeric.pm
_U trunk/Class-Meta/lib/Class/Meta/Types/Perl.pm
_U trunk/Class-Meta/lib/Class/Meta/Types/String.pm
-UU trunk/Class-Meta/lib/Class/Meta.pm
+UU trunk/Class-Meta/lib/Class/Meta.pm
A trunk/Class-Meta/t/view.t
U trunk/Params-CallbackRequest/Changes
U trunk/Params-CallbackRequest/lib/Params/Callback.pm
trunk/SVN-Notify/t/data/changed/333.txt (739 => 740)
--- trunk/SVN-Notify/t/data/changed/333.txt 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/data/changed/333.txt 2004-10-15 06:12:54 UTC (rev 740)
@@ -0,0 +1,3 @@
+UU trunk/activitymail/bin/activitymail
+_U trunk/activitymail/t/activitymail.t
+_U trunk/activitymail/t/zpod.t
trunk/SVN-Notify/t/data/diff/333.txt (739 => 740)
--- trunk/SVN-Notify/t/data/diff/333.txt 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/data/diff/333.txt 2004-10-15 06:12:54 UTC (rev 740)
@@ -0,0 +1,40 @@
+Modified: trunk/activitymail/bin/activitymail
+===================================================================
+--- trunk/activitymail/bin/activitymail 2004-09-28 02:04:18 UTC (rev 681)
++++ trunk/activitymail/bin/activitymail 2004-09-28 05:59:10 UTC (rev 682)
+@@ -3,7 +3,7 @@
+ eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
+ if 0; # not running under some shell
+
+-# $Id: activitymail,v 1.18 2003/08/28 14:49:44 david Exp $
++# $Id$
+
+ use strict;
+ use Getopt::Std;
+@@ -1193,7 +1193,7 @@
+
+ =head1 COPYRIGHT AND LICENSE
+
+-Copyright (c) 2002-2003, David Wheeler. All Rights Reserved.
++Copyright (c) 2002-2004, David Wheeler. All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify it under
+ the same terms as Perl.
+
+
+Property changes on: trunk/activitymail/bin/activitymail
+___________________________________________________________________
+Name: svn:keywords
+ + Id
+
+
+Property changes on: trunk/activitymail/t/activitymail.t
+___________________________________________________________________
+Name: svn:keywords
+ + Id
+
+
+Property changes on: trunk/activitymail/t/zpod.t
+___________________________________________________________________
+Name: svn:keywords
+ + Id
trunk/SVN-Notify/t/data/dirs-changed/333.txt (739 => 740)
--- trunk/SVN-Notify/t/data/dirs-changed/333.txt 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/data/dirs-changed/333.txt 2004-10-15 06:12:54 UTC (rev 740)
@@ -0,0 +1,2 @@
+trunk/activitymail/bin/
+trunk/activitymail/t/
trunk/SVN-Notify/t/data/info/333.txt (739 => 740)
--- trunk/SVN-Notify/t/data/info/333.txt 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/data/info/333.txt 2004-10-15 06:12:54 UTC (rev 740)
@@ -0,0 +1,5 @@
+theory
+2004-05-21 13:43:18 -0700 (Fri, 21 May 2004)
+23
+Property modification.
+
trunk/SVN-Notify/t/html.t (739 => 740)
--- trunk/SVN-Notify/t/html.t 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/html.t 2004-10-15 06:12:54 UTC (rev 740)
@@ -9,7 +9,7 @@
if ($^O eq 'MSWin32') {
plan skip_all => "SVN::Notify::HTML not yet supported on Win32";
} elsif (eval { require HTML::Entities }) {
- plan tests => 103;
+ plan tests => 115;
} else {
plan skip_all => "SVN::Notify::HTML requires HTML::Entities";
}
@@ -212,7 +212,7 @@
# Try html format with a single file changed.
##############################################################################
ok( $notifier = SVN::Notify::HTML->new(%args, revision => '222'),
- "Construct new subject_cx file notifier" );
+ "Construct new HTML file notifier" );
isa_ok($notifier, 'SVN::Notify::HTML');
isa_ok($notifier, 'SVN::Notify');
ok( $notifier->prepare, "Prepare HTML file" );
@@ -263,6 +263,34 @@
'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" );
+
+##############################################################################
# Functions.
##############################################################################
trunk/SVN-Notify/t/htmlcolordiff.t (739 => 740)
--- trunk/SVN-Notify/t/htmlcolordiff.t 2004-10-15 04:25:23 UTC (rev 739)
+++ trunk/SVN-Notify/t/htmlcolordiff.t 2004-10-15 06:12:54 UTC (rev 740)
@@ -9,7 +9,7 @@
if ($^O eq 'MSWin32') {
plan skip_all => "SVN::Notify::HTML::ColorDiff not yet supported on Win32";
} elsif (eval { require HTML::Entities }) {
- plan tests => 104;
+ plan tests => 120;
} else {
plan skip_all => "SVN::Notify::HTML::ColorDiff requires HTML::Entities";
}
@@ -147,10 +147,12 @@
like( $email, qr/<div id="patch">/, "Check for patch div" );
like( $email, qr{<a id="trunkParamsCallbackRequestChanges"></a>\n},
"Check for file div ID");
+like( $email, qr{<div class="modfile"><h4>trunk/Params-CallbackRequest/Changes \(600 => 601\)</h4>},
+ "Check for diff file header" );
like( $email, qr{<a id="trunkParamsCallbackRequestlibParamsCallbackpm"></a>\n},
"Check for added file div ID");
-like( $email, qr{<h3>trunk/Params-CallbackRequest/Changes \(600 => 601\)</h3>},
- "Check for diff file header" );
+like( $email, qr{<div class="addfile"><h4>trunk/Params-CallbackRequest/lib/Params/Callback.pm \(600 => 601\)</h4>},
+ "Check for added diff file header" );
# Make sure that it's not attached.
unlike( $email, qr{Content-Type: multipart/mixed; boundary=},
@@ -168,11 +170,9 @@
like( $email,
qr|<li><a href="#trunkClassMetaChanges">trunk/Class-Meta/Changes</a></li>|,
"Check for linked file name" );
-
-# Property changes aren't escaped.
like( $email,
- qr|<li>trunk/Class-Meta/lib/Class/Meta/Type.pm</li>|,
- "Check for unescaped property change");
+ qr|<li><a href="#trunkClassMetalibClassMetaTypepm">trunk/Class-Meta/lib/Class/Meta/Type\.pm</a></li>|,
+ "Check for linked property change file");
##############################################################################
# Attach diff.
@@ -272,6 +272,41 @@
'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>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>trunk/activitymail/t/activitymail\.t</h4>},
+ "Check for modified file header" );
+
+##############################################################################
# Functions.
##############################################################################