r63443 - in /branches/upstream/libsvn-hooks-perl/current: Changes META.yml README TODO lib/SVN/Hooks.pm lib/SVN/Hooks/DenyFilenames.pm t/02-denyfilenames.t t/02-updateconffile.t
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Wed Oct 6 20:33:37 UTC 2010
Author: angelabad-guest
Date: Wed Oct 6 20:33:24 2010
New Revision: 63443
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=63443
Log:
[svn-upgrade] new version libsvn-hooks-perl (0.29)
Modified:
branches/upstream/libsvn-hooks-perl/current/Changes
branches/upstream/libsvn-hooks-perl/current/META.yml
branches/upstream/libsvn-hooks-perl/current/README
branches/upstream/libsvn-hooks-perl/current/TODO
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyFilenames.pm
branches/upstream/libsvn-hooks-perl/current/t/02-denyfilenames.t
branches/upstream/libsvn-hooks-perl/current/t/02-updateconffile.t
Modified: branches/upstream/libsvn-hooks-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/Changes?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/Changes (original)
+++ branches/upstream/libsvn-hooks-perl/current/Changes Wed Oct 6 20:33:24 2010
@@ -1,4 +1,9 @@
Revision history for SVN-Hooks. -*- text -*-
+
+0.29 2010-10-06
+
+ Extends the syntax of DENY_FILENAME directive to allow
+ customized error messages.
0.28 2010-04-28
Modified: branches/upstream/libsvn-hooks-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/META.yml?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/META.yml (original)
+++ branches/upstream/libsvn-hooks-perl/current/META.yml Wed Oct 6 20:33:24 2010
@@ -1,21 +1,29 @@
--- #YAML:1.0
-name: SVN-Hooks
-version: 0.28
-abstract: A framework for implementing Subversion hooks.
-license: ~
-author:
+name: SVN-Hooks
+version: 0.29
+abstract: A framework for implementing Subversion hooks.
+author:
- Gustavo Chaves <gnustavo at cpan.org>
-generated_by: ExtUtils::MakeMaker version 6.42
-distribution_type: module
-requires:
- Email::Send: 0
- Email::Simple: 0
- Email::Simple::Creator: 0
- JIRA::Client: 0
- SVN::Look: 0
- SVN::Notify: 0
- Test::More: 0
- XMLRPC::Lite: 0
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ Email::Send: 0
+ Email::Simple: 0
+ Email::Simple::Creator: 0
+ JIRA::Client: 0
+ SVN::Look: 0
+ SVN::Notify: 0
+ Test::More: 0
+ XMLRPC::Lite: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libsvn-hooks-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/README?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/README (original)
+++ branches/upstream/libsvn-hooks-perl/current/README Wed Oct 6 20:33:24 2010
@@ -1,6 +1,6 @@
Name: SVN-Hooks
What: Framework for Subversion hooks
-Version: 0.28
+Version: 0.29
Author: Gustavo Chaves <gnustavo at cpan.org>
SVN-Hooks is a framework for creating Subversion hooks
Modified: branches/upstream/libsvn-hooks-perl/current/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/TODO?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/TODO (original)
+++ branches/upstream/libsvn-hooks-perl/current/TODO Wed Oct 6 20:33:24 2010
@@ -36,3 +36,16 @@
http://svn.collab.net/viewvc/svn/trunk/contrib/hook-scripts/case-insensitive.py
* Make each plugin an object factory.
+
+- Move repo to github.
+
+- Substitute Module::Build for ExtUtils::MakeMaker
+
+- investigate Dist::Zilla
+
+- Use a xt/ directory for author tests
+
+- use utf8
+
+- perhaps use open
+
Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm Wed Oct 6 20:33:24 2010
@@ -15,11 +15,11 @@
=head1 VERSION
-Version 0.28
+Version 0.29
=cut
-our $VERSION = '0.28';
+our $VERSION = '0.29';
=head1 SYNOPSIS
@@ -90,7 +90,7 @@
alert interested parties about the commit just done.
There are several useful L<hook scripts
-available|http://subversion.tigris.org/tools_contrib.html#hook_scripts>,
+available|http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/>,
mainly for those three associated with the commit operation. However,
when you try to combine the functionality of two or more of those
scripts in a single hook you normally end up facing two problems.
Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyFilenames.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyFilenames.pm?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyFilenames.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyFilenames.pm Wed Oct 6 20:33:24 2010
@@ -22,25 +22,52 @@
It's active in the C<pre-commit> hook.
-It's configured by the following directives.
+It's configured by the following directive.
-=head2 DENY_FILENAMES(REGEXP, ...)
+=head2 DENY_FILENAMES(REGEXP, [REGEXP => MESSAGE], ...)
This directive denies the addition of new files matching the Regexps
-passed as arguments.
+passed as arguments. If any file or directory added in the commit
+matches one of the specified Regexps the commit is aborted with an
+error message telling about every denied file.
- DENY_FILENAMES(qr/\.(doc|xls|ppt)$/); # ODF only, please
+The arguments may be compiled Regexps or two-element arrays consisting
+of a compiled Regexp and a specific error message. If a file matches
+one of the lone Regexps an error message like this is produced:
+
+ DENY_FILENAMES: filename not allowed: filename
+
+If a file matches a Regexp associated with an error message, the
+specified error message is substituted for the 'filename not allowed'
+default.
+
+Example:
+
+ DENY_FILENAMES(
+ qr/\.(doc|xls|ppt)$/i, # ODF only, please
+ [qr/\.(exe|zip|jar)/i => 'No binaries, please!'],
+ );
=cut
sub DENY_FILENAMES {
- my @regexes = @_;
- foreach my $regex (@regexes) {
- ref $regex eq 'Regexp'
- or croak "$HOOK: got \"$regex\" while expecting a qr/Regex/.\n";
+ my @checks = @_;
+ my $conf = $SVN::Hooks::Confs->{$HOOK};
+ foreach my $check (@checks) {
+ if (ref $check eq 'Regexp') {
+ push @{$conf->{checks}}, [$check => 'filename not allowed'];
+ } elsif (ref $check eq 'ARRAY') {
+ @$check == 2
+ or croak "$HOOK: array arguments must have two arguments.\n";
+ ref $check->[0] eq 'Regexp'
+ or croak "$HOOK: got \"$check->[0]\" while expecting a qr/Regex/.\n";
+ ! ref $check->[1]
+ or croak "$HOOK: got \"$check->[1]\" while expecting a string.\n";
+ push @{$conf->{checks}}, $check;
+ } else {
+ croak "$HOOK: got \"$check\" while expecting a qr/Regex/ or a [qr/Regex/, 'message'].\n";
+ }
}
- my $conf = $SVN::Hooks::Confs->{$HOOK};
- $conf->{checks} = \@regexes;
$conf->{'pre-commit'} = \&pre_commit;
return 1;
@@ -52,21 +79,18 @@
sub pre_commit {
my ($self, $svnlook) = @_;
- my @denied;
+ my $errors;
ADDED:
foreach my $added ($svnlook->added()) {
- foreach my $regex (@{$self->{checks}}) {
- if ($added =~ $regex) {
- push @denied, $added;
+ foreach my $check (@{$self->{checks}}) {
+ if ($added =~ $check->[0]) {
+ $errors .= "$HOOK: $check->[1]: $added\n";
next ADDED;
}
}
}
- if (@denied) {
- croak join("\n",
- "$HOOK: the files below can't be added because their names aren't allowed:",
- @denied), "\n";
- }
+
+ croak $errors if $errors;
}
=head1 AUTHOR
Modified: branches/upstream/libsvn-hooks-perl/current/t/02-denyfilenames.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/t/02-denyfilenames.t?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/t/02-denyfilenames.t (original)
+++ branches/upstream/libsvn-hooks-perl/current/t/02-denyfilenames.t Wed Oct 6 20:33:24 2010
@@ -8,7 +8,7 @@
require "test-functions.pl";
if (can_svn()) {
- plan tests => 4;
+ plan tests => 5;
}
else {
plan skip_all => 'Cannot find or use svn commands.';
@@ -24,29 +24,35 @@
DENY_FILENAMES('string');
EOS
-work_nok('cant parse config', 'DENY_FILENAMES: got "string" while expecting a qr/Regex/', <<"EOS");
+work_nok('cant parse config', 'DENY_FILENAMES: got "string" while expecting a qr/Regex/ or a', <<"EOS");
touch $t/wc/f
svn add -q --no-auto-props $t/wc/f
svn ci -mx $t/wc/f
EOS
set_conf(<<'EOS');
-DENY_FILENAMES(qr/[^\w]/i, qr/substring/);
+DENY_FILENAMES(qr/[^\w]/i, qr/substring/, [qr/custommessage/ => 'custom message']);
EOS
work_ok('valid', <<"EOS");
svn ci -mx $t/wc/f
EOS
-work_nok('invalid', 'DENY_FILENAMES: the files below can\'t be added because their names aren\'t allowed', <<"EOS");
+work_nok('invalid', 'DENY_FILENAMES: filename not allowed: f', <<"EOS");
touch $t/wc/f,
svn add -q --no-auto-props $t/wc/f,
svn ci -mx $t/wc/f,
EOS
-work_nok('second invalid', 'DENY_FILENAMES: the files below can\'t be added because their names aren\'t allowed', <<"EOS");
+work_nok('second invalid', 'DENY_FILENAMES: filename not allowed: withsubstringinthemiddle', <<"EOS");
touch $t/wc/withsubstringinthemiddle
svn add -q --no-auto-props $t/wc/withsubstringinthemiddle
svn ci -mx $t/wc/withsubstringinthemiddle
EOS
+work_nok('custom message', 'DENY_FILENAMES: custom message: withcustommessage', <<"EOS");
+touch $t/wc/withcustommessage
+svn add -q --no-auto-props $t/wc/withcustommessage
+svn ci -mx $t/wc/withcustommessage
+EOS
+
Modified: branches/upstream/libsvn-hooks-perl/current/t/02-updateconffile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/t/02-updateconffile.t?rev=63443&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/t/02-updateconffile.t (original)
+++ branches/upstream/libsvn-hooks-perl/current/t/02-updateconffile.t Wed Oct 6 20:33:24 2010
@@ -125,7 +125,7 @@
cmp $t/wc/generated $t/repo/conf/generate
EOS
-set_conf(<<'EOS');
+my $conf = <<'EOS';
UPDATE_CONF_FILE(subfile => 'subdir');
UPDATE_CONF_FILE(qr/^file(\d)$/ => '$1-file');
@@ -133,7 +133,7 @@
sub actuate {
my ($text, $file) = @_;
die "undefined second argument" unless defined $file;
- open F, '>', "/tmp/actuated" or die $!;
+ open F, '>', "TTT/repo/conf/really-actuated" or die $!;
print F $text;
close F;
}
@@ -141,6 +141,10 @@
UPDATE_CONF_FILE(actuate => 'actuate',
actuator => \&actuate);
EOS
+
+$conf =~ s/TTT/$t/;
+
+set_conf($conf);
mkdir "$t/repo/conf/subdir";
@@ -162,5 +166,5 @@
echo asdf >$t/wc/actuate
svn add -q --no-auto-props $t/wc/actuate
svn ci -mx $t/wc/actuate
-cmp $t/wc/actuate /tmp/actuated
+cmp $t/wc/actuate $t/repo/conf/really-actuated
EOS
More information about the Pkg-perl-cvs-commits
mailing list