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;
+ }
}
}