Author: mcbrown
Date: 2008-02-28 13:45:06 +0100 (Thu, 28 Feb 2008)
New Revision: 10056
Log:
Fixing an issue in ID mapping where entities from a specific prefix (for example,
¤t-series) would not get resolve to their prefix correct alternative
Adding support for --title to extract a title during idfind
Modified:
trunk/tools/MySQL/IDMap.pm
trunk/tools/idfind.pl
Modified: trunk/tools/MySQL/IDMap.pm
===================================================================
--- trunk/tools/MySQL/IDMap.pm 2008-02-28 10:35:41 UTC (rev 10055)
+++ trunk/tools/MySQL/IDMap.pm 2008-02-28 12:45:06 UTC (rev 10056)
Changed blocks: 2, Lines Added: 13, Lines Deleted: 3; 1130 bytes
@@ -677,7 +677,15 @@
{
my $repl = $self->{entities}->{$entity}->{$prefix} ||
$self->{entities}->{$entity}->{'_value'};
- $string =~ s/&$entity;/$repl/ if (defined($entity) &&
defined($repl));
+
+ if (defined($entity) && defined($repl))
+ {
+ $string =~ s/&$entity;/$repl/;
+ }
+ else
+ {
+ print STDERR "WARNING: Couldn't replace entity $entity; probably
harmless\n";
+ }
}
}
return($string);
@@ -691,9 +699,11 @@
my $entities = {};
- foreach my $prefix (@{$srcs})
+ foreach my $origprefix (@{$srcs})
{
- my @maps = glob($prefix . '/' . '*.ent');
+ my $prefix = $self->resolvefilename('',$origprefix);
+
+ my @maps = glob($origprefix . '/' . '*.ent');
foreach my $file (@maps)
{
Modified: trunk/tools/idfind.pl
===================================================================
--- trunk/tools/idfind.pl 2008-02-28 10:35:41 UTC (rev 10055)
+++ trunk/tools/idfind.pl 2008-02-28 12:45:06 UTC (rev 10056)
Changed blocks: 2, Lines Added: 25, Lines Deleted: 11; 2887 bytes
@@ -23,12 +23,13 @@
use Getopt::Long;
use Data::Dumper;
-my ($srcpathopt,$debug,$showreverse,$showlevel,$showtype,$optformat) = ('',0,0,0,'','');
+my ($srcpathopt,$debug,$showreverse,$showtitle,$showlevel,$showtype,$optformat) =
('',0,0,0,0,'','');
my @srcpaths = ();
GetOptions("srcpaths=s" => \$srcpathopt,
"debug" => \$debug,
"r" => \$showreverse,
+ "title" => \$showtitle,
"type=s" => \$showtype,
"level=s" => \$showlevel,
"format=s" => \$optformat);
@@ -117,23 +118,36 @@
{
next if ($match =~ m/__.*?__/);
+ if ($showtitle)
+ {
+ print "$idmap->{byid}->{$match}->{title} [$match] is located
within
$idmap->{byid}->{$match}->{prefix}/$idmap->{byid}->{$match}->{file}\n";
+ }
+ else
+ {
+ print "$match is located within
$idmap->{byid}->{$match}->{prefix}/$idmap->{byid}->{$match}->{file}\n";
+ }
+ print Dumper($idmap->{byid}->{$match}),"\n" if ($debug);
+
if (exists($idmap->{byid}->{$match}->{alts}))
{
- print "$match is located within
$idmap->{byid}->{$match}->{prefix}/$idmap->{byid}->{$match}->{file}\n";
- print Dumper($idmap->{byid}->{$match}),"\n" if ($debug);
foreach my $prefix (@{$idmap->{byid}->{$match}->{adds}})
{
next if ($prefix eq $idmap->{byid}->{$match}->{prefix});
- printf(" -> also located within %s/%s\n",
- $prefix,
-
$idmap->{byprefixid}->{$prefix}->{$match}->{file});
+ if ($showtitle)
+ {
+ printf(" -> also located within %s/%s (%s)\n",
+ $prefix,
+
$idmap->{byprefixid}->{$prefix}->{$match}->{file},
+
$idmap->{byprefixid}->{$prefix}->{$match}->{title});
+ }
+ else
+ {
+ printf(" -> also located within %s/%s\n",
+ $prefix,
+
$idmap->{byprefixid}->{$prefix}->{$match}->{file});
+ }
}
}
- else
- {
- print "$match is located within
$idmap->{byid}->{$match}->{prefix}/$idmap->{byid}->{$match}->{file}\n";
- print Dumper($idmap->{byid}->{$match}),"\n" if ($debug);
- }
if ($showreverse &&
exists($idmap->{reversebyid}->{$match}))
{
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r10056 - in trunk/tools: . MySQL | mcbrown | 28 Feb |