[Bps-public-commit] r17470 - in Net-Trac/trunk: .
trs at bestpractical.com
trs at bestpractical.com
Tue Dec 30 23:29:23 EST 2008
Author: trs
Date: Tue Dec 30 23:29:22 2008
New Revision: 17470
Modified:
Net-Trac/trunk/ (props changed)
Net-Trac/trunk/lib/Net/Trac/TicketHistoryEntry.pm
Log:
r43329 at zot: tom | 2008-12-30 23:29:04 -0500
Only record prop change objects if we have an actual property and not just an empty one
Modified: Net-Trac/trunk/lib/Net/Trac/TicketHistoryEntry.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/TicketHistoryEntry.pm (original)
+++ Net-Trac/trunk/lib/Net/Trac/TicketHistoryEntry.pm Tue Dec 30 23:29:22 2008
@@ -25,10 +25,8 @@
my $desc = $e->content->body;
if ( $desc =~ s/^\s*<ul>\s*?<li>(.*?)<\/li>\s*?<\/ul>//gism ) {
-
my $props = $1;
$self->prop_changes( $self->_parse_props($props) );
-
}
$self->content($desc);
@@ -41,31 +39,29 @@
my @prop_lines = split( m#</li>\s*<li>#, $raw );
my $props = {};
foreach my $line (@prop_lines) {
- my $prop = '';
- my $new = '';
- my $old = '';
- if ( $line
- =~ /<strong>(.*?)<\/strong> changed from <em>(.*)<\/em> to <em>(.*)<\/em>/
- )
- {
+ my ($prop, $old, $new);
+
+ if ( $line =~ m{<strong>(.*?)</strong> changed from <em>(.*)</em> to <em>(.*)</em>} ) {
$prop = $1;
$old = $2;
$new = $3;
- } elsif ( $line =~ /<strong>(.*?)<\/strong> set to <em>(.*)<\/em>/ ) {
+ } elsif ( $line =~ m{<strong>(.*?)</strong> set to <em>(.*)</em>} ) {
$prop = $1;
$old = '';
$new = $2;
- } elsif ( $line =~ /<strong>(.*?)<\/strong> deleted/ ) {
+ } elsif ( $line =~ m{<strong>(.*?)</strong> deleted} ) {
$prop = $1;
$new = '';
}
- my $pc = Net::Trac::TicketPropChange->new(
- property => $prop,
- new_value => $new,
- old_value => $old
- );
- $props->{$prop} = $pc;
+ if ( $prop ) {
+ my $pc = Net::Trac::TicketPropChange->new(
+ property => $prop,
+ new_value => $new,
+ old_value => $old
+ );
+ $props->{$prop} = $pc;
+ }
}
return $props;
}
More information about the Bps-public-commit
mailing list