Dirk wrote:
Hi,
I don't wanted to start a language discussion here ;-), I just wanted
to know, how I can evaluate a regular expression from the ini-file on
a file name ;-) That's all.
As far as that goes, I think having a list of all the auto-props would
work better; I'm not sure how to make that work using a hash. Each
expression in the ini file would need to be converted into a regular
expression. It looks like Text::Glob::glob_to_regex() is exactly what
would be needed[1]. (That would add another dependency; Text::Glob is
not "standard" but is from CPAN so that's OK... or we could simply pull
in the source for that function[2]).
So then we'd need an array of hashes to contain the regex, the property,
and the value:
@autoprops = ( {
regex => glob_to_regex('*.cpp'),
prop => 'svn:eol-style',
value => 'native',
} ... );
(Of course this is actually loaded from the ini file).
So, when you have a filename $file (where the path info has already been
stripped off), you would need to test every auto-prop to see if it matches:
foreach my $autoprop (@autoprops) {
if ($file =~ m/$autoprop->{'regex'}/) {
$node->add_prop($autoprop->{'prop'}, $autoprop->{'value'});
}
}
[1]http://search.cpan.org/~rclamp/Text-Glob-0.07/lib/Text/Glob.pm
[2]http://search.cpan.org/src/RCLAMP/Text-Glob-0.07/lib/Text/Glob.pm
_______________________________________________
vss2svn-users mailing list
Project homepage:
http://www.pumacode.org/projects/vss2svn/
Subscribe/Unsubscribe/Admin:
http://lists.pumacode.org/mailman/listinfo/vss2svn-users-lists.pumacode.org
Mailing list web interface (with searchable archives):
http://dir.gmane.org/gmane.comp.version-control.subversion.vss2svn.user