From 76f91dfc590307ccd0670155ab7c8737e9623a86 Mon Sep 17 00:00:00 2001 From: ldavis Date: Tue, 30 Oct 2007 21:32:07 +0000 Subject: [PATCH] Now matches auto-props in a case-insensitive manner (see subversion issue 2036 and comments for revision 25124). It was easiest to do this by storing the auto-props in a list and precompiling the regex. git-svn-id: http://vss2svn.googlecode.com/svn/trunk@329 2cfd5912-9055-84bd-9a12-e3c18a4b6e42 --- script/Vss2Svn/Dumpfile/AutoProps.pm | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/script/Vss2Svn/Dumpfile/AutoProps.pm b/script/Vss2Svn/Dumpfile/AutoProps.pm index f6f6403..b812741 100644 --- a/script/Vss2Svn/Dumpfile/AutoProps.pm +++ b/script/Vss2Svn/Dumpfile/AutoProps.pm @@ -11,15 +11,27 @@ use Text::Glob; sub new { my($class, $conf) = @_; - my $self = - { - config => new Config::Ini( $conf, -commentdelim => "#" ), - }; + my $config = new Config::Ini( $conf, -commentdelim => "#" ); - my ($enabled) = $self->{config}->get (['miscellany', 'enable-auto-props']); + my $self = (); + $self->{entries} = (); + + my ($enabled) = $config->get (['miscellany', 'enable-auto-props']); if (defined $enabled && $enabled eq "yes") { - $self->{autoprops} = $self->{config}->get (['auto-props']); + my $autoprops_list = $config->get (['auto-props']); + + # see http://subversion.tigris.org/servlets/ReadMsg?list=svn&msgNo=29642 + # matches are performed in a case-insensitive manner + + my ($glob, $autoprops); + while (($glob, $autoprops) = each %{ $autoprops_list }) { + my $entry = (); + my $regex = Text::Glob::glob_to_regex_string($glob); + $entry->{glob} = qr/$regex/i; + $entry->{props} = $autoprops; + push @{$self->{entries}}, $entry; + } } $self = bless($self, $class); @@ -39,11 +51,9 @@ sub get_props { my @subdirs = split '/', $path; my $item = pop(@subdirs); - my ($glob, $autoprops); - while (($glob, $autoprops) = each %{ $self->{autoprops} }) { -# print $glob, $item, "\n"; - if (Text::Glob::match_glob($glob, $item)) { - foreach my $autoprop (@$autoprops) + foreach my $entry (@{$self->{entries}}) { + if ($item =~ /$entry->{glob}/) { + foreach my $autoprop (@{$entry->{props}}) { my @props = split ';', $autoprop; foreach my $prop (@props) -- 2.11.4.GIT