Skip Menu |

This queue is for tickets about the SVN-Notify-Config CPAN distribution.

Report information
The Basics
Id: 16509
Status: resolved
Priority: 0/
Queue: SVN-Notify-Config

People
Owner: jpeacock [...] cpan.org
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.06
Fixed in: (no value)



Subject: Allow cascading actions to be defined
Current implementation only use the last matching config section to select actions: '/foo' - handler Foo '/foo/bar' - handler FooBar A commit in '/foo/bar' will only trigger actions defined in the second section. The attached patch change this behaviour, and use all actions with compatible path, thus using actions for both section in the previous example. Old behaviour is still achievable by using negative-look ahead assertions in configuration: '/foo(?:/bar)' - handler Foo '/foo/bar' - handler FooBar
--- /usr/lib/perl5/vendor_perl/5.8.7/SVN/Notify/Config.pm 2004-11-23 13:57:23.000000000 +0100 +++ Config.pm 2005-12-15 14:42:11.000000000 +0100 @@ -61,6 +61,8 @@ ); }; + $ENV{SVNLOOK} = '/usr/bin/svnlook'; + foreach my $config (@config) { $config =~ s/\$0/$0/g; $config =~ s/\$(\d+)/$ARGV[$1-1]/eg; @@ -145,31 +147,31 @@ } } @$values } @actions; - } - foreach my $value (@actions) { - %$value = (%$value, %args); + foreach my $value (@actions) { + %$value = (%$value, %args); - $value->{handler} or next; + $value->{handler} or next; - foreach my $key (sort keys %$value) { - my $vval = $value->{$key}; - next if ref($vval); - $vval =~ s{\$\{([-\w]+)\}} - {$value->{$self->_normalize_key($1)}}eg; - $vval =~ s{\%\{(.+?)\}} - {require POSIX; POSIX::strftime($1, localtime(time))}eg; - $value->{$key} = $vval; - } + foreach my $key (sort keys %$value) { + my $vval = $value->{$key}; + next if ref($vval); + $vval =~ s{\$\{([-\w]+)\}} + {$value->{$self->_normalize_key($1)}}eg; + $vval =~ s{\%\{(.+?)\}} + {require POSIX; POSIX::strftime($1, localtime(time))}eg; + $value->{$key} = $vval; + } - fork and exit if $value->{fork}; + fork and exit if $value->{fork}; - local %ENV = %ENV; - $ENV{$_} = $value->{$_} for grep !/\p{IsLower}/, keys %$value; + local %ENV = %ENV; + $ENV{$_} = $value->{$_} for grep !/\p{IsLower}/, keys %$value; - my $notify = SVN::Notify->new(%$value); - $notify->prepare; - $notify->execute; + my $notify = SVN::Notify->new(%$value); + $notify->prepare; + $notify->execute; + } } }
I'm going to consider this patch. The only reservation I have is that it is not a backwards compatible change (i.e. you can still have the old behavior, but you have to change your config file to do it). I may come to the conclusion that this is OK, or I may decide to enable it only if an additional config option (Cascading: 1) is set. Thanks John
I've applied this and produced tests for it. 0.09 should be on its way to CPAN this evening.