Author: mcbrown
Date: 2006-09-06 16:28:24 +0200 (Wed, 06 Sep 2006)
New Revision: 3259
Log:
Added support for 'fuzzy' matching
Fixed so it will work in trunk
Fixed so it will return multiple matches
Modified:
trunk/tools/IDMap.pm
trunk/tools/idfind.pl
Modified: trunk/tools/IDMap.pm
===================================================================
--- trunk/tools/IDMap.pm 2006-09-06 13:01:44 UTC (rev 3258)
+++ trunk/tools/IDMap.pm 2006-09-06 14:28:24 UTC (rev 3259)
Changed blocks: 1, Lines Added: 16, Lines Deleted: 8; 1140 bytes
@@ -50,14 +50,22 @@
{
chomp $line;
my ($id,$type,$parent,$srcfile,$urlbase,$title) = split /:/,$line,6;
- $self->{$id} = {id => $id,
- type => $type,
- parent => $parent,
- file => $srcfile,
- prefix => $prefix,
- urlbase => $urlbase,
- title => $title,
- };
+
+ if (exists($self->{$id}))
+ {
+ push @{$self->{$id}->{adds}},$prefix;
+ }
+ else
+ {
+ $self->{$id} = {id => $id,
+ type => $type,
+ parent => $parent,
+ file => $srcfile,
+ prefix => $prefix,
+ urlbase => $urlbase,
+ title => $title,
+ };
+ }
}
}
Modified: trunk/tools/idfind.pl
===================================================================
--- trunk/tools/idfind.pl 2006-09-06 13:01:44 UTC (rev 3258)
+++ trunk/tools/idfind.pl 2006-09-06 14:28:24 UTC (rev 3259)
Changed blocks: 2, Lines Added: 38, Lines Deleted: 6; 2160 bytes
@@ -9,13 +9,34 @@
# 2006-09-06
use strict;
-use lib qw(../tools ../../tools);
+use lib qw(./tools ../tools ../../tools);
use IDMap;
use Getopt::Long;
use strict;
my ($srcpathopt) = ('');
-my @srcpaths = ('.','../refman-common','../gui-common','../internals','../query-browser','../administrator','../migration-toolkit','../workbench');
+my @srcpaths = ('.',
+ '../refman-5.1',
+ '../refman-5.0',
+ '../refman-4.1',
+ '../refman-common',
+ '../gui-common',
+ '../internals',
+ '../query-browser',
+ '../administrator',
+ '../migration-toolkit',
+ '../workbench',
+ './refman-5.1',
+ './refman-5.0',
+ './refman-4.1',
+ './refman-common',
+ './gui-common',
+ './internals',
+ './query-browser',
+ './administrator',
+ './migration-toolkit',
+ './workbench',
+ );
GetOptions("srcpaths=s" => \$srcpathopt);
@@ -30,13 +51,24 @@
foreach my $id (@ARGV)
{
- if (exists($idmap->{$id}))
+ my @matches = grep /$id/,keys %{$idmap};
+
+ if (scalar @matches == 0)
{
- print "$id is located within $idmap->{$id}->{prefix}/$idmap->{$id}->{file}\n";
+ print "Can't find $id in current maps (from @srcpaths)\n";
}
- else
+
+ foreach my $match (sort @matches)
{
- print "Can't find $id in current maps (from @srcpaths)\n";
+ if (exists($idmap->{$match}->{adds}))
+ {
+ print "$match is located within $idmap->{$match}->{prefix}/$idmap->{$match}->{file}\n";
+ print " -> also located within ",join(', ',@{$idmap->{$match}->{adds}}),"\n";
+ }
+ else
+ {
+ print "$match is located within $idmap->{$match}->{prefix}/$idmap->{$match}->{file}\n";
+ }
}
}
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r3259 - trunk/tools | mcbrown | 6 Sep |