Author: mcbrown
Date: 2007-11-01 19:42:13 +0100 (Thu, 01 Nov 2007)
New Revision: 8476
Log:
Adding support for in-place selection and filtering of dynamic changelog output
Fix to parser that ensures the original match is quoted during the regexp replacement
Modified:
trunk/tools/MySQL/DynXML/Changelog.pm
trunk/tools/dynxml-parser.pl
Modified: trunk/tools/MySQL/DynXML/Changelog.pm
===================================================================
--- trunk/tools/MySQL/DynXML/Changelog.pm 2007-11-01 18:28:52 UTC (rev 8475)
+++ trunk/tools/MySQL/DynXML/Changelog.pm 2007-11-01 18:42:13 UTC (rev 8476)
Changed blocks: 3, Lines Added: 91, Lines Deleted: 1; 3730 bytes
@@ -117,6 +117,10 @@
{
$string = $self->generate_entrylist($version,$options);
}
+ elsif ($tabletype eq 'difflist')
+ {
+ $string = $self->generate_difflist($version,$filter,$options);
+ }
elsif ($tabletype eq 'openbugslist')
{
# For an open bugs list, we order by the embedded category
@@ -137,6 +141,92 @@
return($string);
}
+sub generate_difflist
+{
+ my ($self,$ver,$filter,$options) = @_;
+
+ my ($low,$high) = ($ver,$ver);
+
+ ($low,$high) = split(/-/,$ver)
+ if ($ver =~ m/[\d\.]+-[\d\.]+/);
+
+ $low = $self->{dynxmlcore}->vertodec($low);
+ $high = $self->{dynxmlcore}->vertodec($high);
+
+ my $verlist = {};
+
+ foreach my $ver (keys
%{$self->{tdcache}->{$options->{product}}->{versions}})
+ {
+ if (($self->{dynxmlcore}->vertodec($ver) >= $low) and
($self->{dynxmlcore}->vertodec($ver) <= $high))
+ {
+ $verlist->{$self->{dynxmlcore}->vertodec($ver)} = $ver;
+ }
+ }
+
+ my @vers = map {$verlist->{$_} } sort keys %{$verlist};
+
+ # Parse the contents of the filter
+
+ my ($taghighlightmap,$tagmanualmap) = ({},{});
+
+ my ($highlights,$manuals);
+
+ if ($filter =~ m/highlight\[(.*?)\]/)
+ {
+ foreach my $tag (split /,/,$1)
+ {
+ $taghighlightmap->{$tag} = 1;
+ }
+ }
+ if ($filter =~ m/manual\[(.*?)\]/)
+ {
+ foreach my $tag (split /,/,$1)
+ {
+ $tagmanualmap->{$tag} = 1;
+ }
+ }
+
+ my $md5s = {};
+
+ foreach my $version (@vers)
+ {
+ foreach my $md5
(@{$self->{tdcache}->{$options->{product}}->{entriesbyversion}->{$version}})
+ {
+ foreach my $hltag (keys %{$taghighlightmap})
+ {
+ push(@{$md5s->{$version}},$md5)
+ if
(exists($self->{tdcache}->{$options->{product}}->{logentries}->{$md5}->{tagsbytype}->{highlight}->{$hltag}));
+ }
+ foreach my $hltag (keys %{$tagmanualmap})
+ {
+ push(@{$md5s->{$version}},$md5)
+ if
(exists($self->{tdcache}->{$options->{product}}->{logentries}->{$md5}->{tagsbytype}->{manual}->{$hltag}));
+ }
+ }
+ }
+
+ my $custom_options = {product => 'customlist'};
+
+ $self->{tdcache}->{customlist}->{logentries} =
$self->{tdcache}->{$options->{product}}->{logentries};
+ $self->{tdcache}->{customlist}->{versions} =
$self->{tdcache}->{$options->{product}}->{versions};
+ $self->{tdcache}->{customlist}->{entriesbyversion} = $md5s;
+
+ my @lines;
+ foreach my $version (sort { $self->{dynxmlcore}->vertodec($b) <=>
+ $self->{dynxmlcore}->vertodec($a) }
+ keys %{$md5s})
+ {
+ push @lines,'<section>';
+ push @lines,$self->generate_vertitle($version,$custom_options);
+
+ push @lines,$self->generate_entrylist($version,$custom_options);
+ push @lines,'</section>';
+ }
+
+ return join('',@lines);
+}
+
+
sub generate_vertitle
{
my ($self,$ver,$options) = @_;
@@ -508,7 +598,7 @@
$logentries->{$md5}->{fixedin});
}
elsif (exists($logentries->{$md5}->{fixedin}) &&
-
$self->{dynxmlcore}->vertodec($logentries->{$md5}->{fixedin}) <
$options->{fixedin})
+
$self->{dynxmlcore}->vertodec($logentries->{$md5}->{fixedin}) <
$self->{dynxmlcore}->vertodec($options->{fixedin}))
{
next;
}
Modified: trunk/tools/dynxml-parser.pl
===================================================================
--- trunk/tools/dynxml-parser.pl 2007-11-01 18:28:52 UTC (rev 8475)
+++ trunk/tools/dynxml-parser.pl 2007-11-01 18:42:13 UTC (rev 8476)
Changed blocks: 1, Lines Added: 2, Lines Deleted: 1; 521 bytes
@@ -160,8 +160,9 @@
{
print STDERR "$0: WARNING: Dynamic datatype $inserttype not recognized\n";
}
+ my $qitem = quotemeta($item);
- $inplacefile =~ s/$item/$string/g;
+ $inplacefile =~ s/$qitem/$string/g;
}
my @lines;
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r8476 - in trunk/tools: . MySQL/DynXML | mcbrown | 1 Nov |