r32023 - in /trunk/libsvn-hooks-perl: Changes MANIFEST META.yml README TODO debian/changelog lib/SVN/Hooks.pm lib/SVN/Hooks/CheckStructure.pm t/02-checkstructure.t t/02-checkstructurealone.t
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Fri Mar 13 09:29:44 UTC 2009
Author: angelabad-guest
Date: Fri Mar 13 09:29:40 2009
New Revision: 32023
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32023
Log:
New upstream release - 0.15.41
Added:
trunk/libsvn-hooks-perl/t/02-checkstructurealone.t
- copied unchanged from r32022, branches/upstream/libsvn-hooks-perl/current/t/02-checkstructurealone.t
Modified:
trunk/libsvn-hooks-perl/Changes
trunk/libsvn-hooks-perl/MANIFEST
trunk/libsvn-hooks-perl/META.yml
trunk/libsvn-hooks-perl/README
trunk/libsvn-hooks-perl/TODO
trunk/libsvn-hooks-perl/debian/changelog
trunk/libsvn-hooks-perl/lib/SVN/Hooks.pm
trunk/libsvn-hooks-perl/lib/SVN/Hooks/CheckStructure.pm
trunk/libsvn-hooks-perl/t/02-checkstructure.t
Modified: trunk/libsvn-hooks-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/Changes?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/Changes (original)
+++ trunk/libsvn-hooks-perl/Changes Fri Mar 13 09:29:40 2009
@@ -1,4 +1,14 @@
-Revision history for SVN-Look. -*- text -*-
+Revision history for SVN-Hooks. -*- text -*-
+
+0.15 2009-03-12
+
+ Corrects a nasty bug in CheckStructure.
+
+ Corrects some problems with the test scripts that prevented
+ them to work right in some environments.
+
+ Implements the function
+ SVN::Hooks::CheckStructure::check_structure.
0.14 2009-02-08
Modified: trunk/libsvn-hooks-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/MANIFEST?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/MANIFEST (original)
+++ trunk/libsvn-hooks-perl/MANIFEST Fri Mar 13 09:29:40 2009
@@ -22,6 +22,7 @@
t/02-checkmimetypes.t
t/02-checkproperty.t
t/02-checkstructure.t
+t/02-checkstructurealone.t
t/02-denychanges.t
t/02-denyfilenames.t
t/02-jiraacceptance.t
Modified: trunk/libsvn-hooks-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/META.yml?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/META.yml (original)
+++ trunk/libsvn-hooks-perl/META.yml Fri Mar 13 09:29:40 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: SVN-Hooks
-version: 0.14.38
+version: 0.15.41
abstract: A framework for implementing Subversion hooks.
license: ~
author:
Modified: trunk/libsvn-hooks-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/README?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/README (original)
+++ trunk/libsvn-hooks-perl/README Fri Mar 13 09:29:40 2009
@@ -1,6 +1,6 @@
Name: SVN-Hooks
What: Framework for Subversion hooks
-Version: 0.14
+Version: 0.15
Author: Gustavo Chaves <gnustavo at cpan.org>
SVN-Hooks is a framework for creating Subversion hooks
Modified: trunk/libsvn-hooks-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/TODO?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/TODO (original)
+++ trunk/libsvn-hooks-perl/TODO Fri Mar 13 09:29:40 2009
@@ -34,3 +34,5 @@
* Implement a clone of
http://svn.collab.net/viewvc/svn/trunk/contrib/hook-scripts/case-insensitive.py
+
+* Make each plugin an object factory.
Modified: trunk/libsvn-hooks-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/debian/changelog?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/debian/changelog (original)
+++ trunk/libsvn-hooks-perl/debian/changelog Fri Mar 13 09:29:40 2009
@@ -1,3 +1,9 @@
+libsvn-hooks-perl (0.15.41-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Angel Abad (Ikusnet SLL) <angel at grupoikusnet.com> Fri, 13 Mar 2009 10:24:16 +0100
+
libsvn-hooks-perl (0.14.38-1) unstable; urgency=low
* New upstream release
Modified: trunk/libsvn-hooks-perl/lib/SVN/Hooks.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/lib/SVN/Hooks.pm?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/lib/SVN/Hooks.pm (original)
+++ trunk/libsvn-hooks-perl/lib/SVN/Hooks.pm Fri Mar 13 09:29:40 2009
@@ -15,11 +15,11 @@
=head1 VERSION
-Version 0.14
+Version 0.15
=cut
-our $VERSION = '0.14.' . (q$Revision: 38 $ =~ / (\d+) /)[0]; # bump from 36
+our $VERSION = '0.15.' . (q$Revision: 41 $ =~ / (\d+) /)[0]; # bump from 38
=head1 SYNOPSIS
Modified: trunk/libsvn-hooks-perl/lib/SVN/Hooks/CheckStructure.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/lib/SVN/Hooks/CheckStructure.pm?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/lib/SVN/Hooks/CheckStructure.pm (original)
+++ trunk/libsvn-hooks-perl/lib/SVN/Hooks/CheckStructure.pm Fri Mar 13 09:29:40 2009
@@ -6,7 +6,7 @@
use Exporter qw/import/;
my $HOOK = 'CHECK_STRUCTURE';
-our @EXPORT = ($HOOK);
+our @EXPORT = ($HOOK, 'check_structure');
our $VERSION = $SVN::Hooks::VERSION;
@@ -143,51 +143,38 @@
sub _check_structure {
my ($structure, $path) = @_;
- my $component = shift @$path;
-
- if (! defined $structure) {
- return (1);
- }
- elsif (! ref $structure) {
+ @$path > 0 or die "Can't happen!";
+
+ if (! ref $structure) {
if ($structure eq 'DIR') {
- if (defined $component) {
- return (1);
- }
- else {
- return (0, "a FILE should be a DIRECTORY in");
- }
+ return (1) if @$path > 1;
+ return (0, "the component ($path->[0]) should be a DIR in");
}
elsif ($structure eq 'FILE') {
- if (defined $component) {
- return (0, "a DIRECTORY should be a FILE in");
- }
- else {
- return (1);
- }
+ return (0, "the component ($path->[0]) should be a FILE in") if @$path > 1;
+ return (1);
}
elsif ($structure =~ /^\d+$/) {
- if ($structure) {
- return (1);
- }
- else {
- return (0, "invalid path");
- }
+ return (1) if $structure;
+ return (0, "invalid path");
}
else {
return (0, "syntax error: unknown string spec ($structure), while checking");
}
}
elsif (ref $structure eq 'ARRAY') {
- if (scalar(@$path) == 0 && $component eq '') {
- return (1);
- }
- if (scalar(@$structure) % 2 != 0) {
- return (0, "syntax error: odd number of elements in the structure spec, while checking")
- }
+ return (0, "syntax error: odd number of elements in the structure spec, while checking")
+ unless scalar(@$structure) % 2 == 0;
+ return (0, "the component ($path->[0]) should be a DIR in")
+ unless @$path > 1;
+ shift @$path;
+ # Return ok if the directory doesn't have subcomponents.
+ return (1) if @$path == 1 && length($path->[0]) == 0;
+
for (my $s=0; $s<$#$structure; $s+=2) {
my ($lhs, $rhs) = @{$structure}[$s, $s+1];
if (! ref $lhs) {
- if ($lhs eq $component) {
+ if ($lhs eq $path->[0]) {
return _check_structure($rhs, $path);
}
elsif ($lhs =~ /^\d+$/) {
@@ -203,7 +190,7 @@
}
}
elsif (ref $lhs eq 'Regexp') {
- if ($component =~ $lhs) {
+ if ($path->[0] =~ $lhs) {
return _check_structure($rhs, $path);
}
}
@@ -212,7 +199,7 @@
return (0, "syntax error: the left hand side of arrays in the structure spec must be scalars or qr/Regexes/, not $what, while checking");
}
}
- return (0, "the component ($component) is not allowed in");
+ return (0, "the component ($path->[0]) is not allowed in");
}
else {
my $what = ref $structure;
@@ -220,13 +207,45 @@
}
}
+=head1 EXPORT
+
+=head2 check_structure(STRUCT_DEF, PATH)
+
+SVN::Hooks::CheckStructure exports a function to allow for the
+verification of path structures outside the context of a Subversion
+hook. (It would probably be better to take this function to its own
+module and use that module here.)
+
+The function check_structure takes two arguments. The first is a
+STRUCT_DEF exactly the same as specified for the CHECK_STRUCTURE
+directive above. The second is a PATH to a file which will be checked
+against the STRUCT_DEF.
+
+The function returns true if the check succeeds and dies with a proper
+message otherwise.
+
+=cut
+
+sub check_structure {
+ my ($structure, $path) = @_;
+ my @path = split '/', $path, -1; # preserve trailing empty components
+ my ($code, $error) = _check_structure($structure, \@path);
+ die "$path: $error\n" if $code == 0;
+ 1;
+}
+
sub pre_commit {
my ($self, $svnlook) = @_;
my @errors;
foreach my $added ($svnlook->added()) {
- my @added = split '/', $added, -1; # preserve trailing empty components
+ # Split the $added path in its components. We prefix $added
+ # with a slash to make it look like an absolute path for
+ # _check_structure. The '-1' is to preserve trailing empty
+ # components so that we can differentiate directory paths from
+ # file paths.
+ my @added = split '/', "/$added", -1;
my ($code, $error) = _check_structure($self->{structure}, \@added);
push @errors, "$error: $added" if $code == 0;
}
Modified: trunk/libsvn-hooks-perl/t/02-checkstructure.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsvn-hooks-perl/t/02-checkstructure.t?rev=32023&op=diff
==============================================================================
--- trunk/libsvn-hooks-perl/t/02-checkstructure.t (original)
+++ trunk/libsvn-hooks-perl/t/02-checkstructure.t Fri Mar 13 09:29:40 2009
@@ -59,7 +59,7 @@
svn ci -mx $t/wc/allow
EOS
-work_nok('is not file', 'a DIRECTORY should be a FILE in', <<"EOS");
+work_nok('is not file', 'the component (file) should be a FILE in', <<"EOS");
mkdir $t/wc/file
svn add -q --no-auto-props $t/wc/file
svn ci -mx $t/wc/file
@@ -72,7 +72,7 @@
svn ci -mx $t/wc/file
EOS
-work_nok('is not dir', 'a FILE should be a DIRECTORY in', <<"EOS");
+work_nok('is not dir', 'the component (dir) should be a DIR in', <<"EOS");
touch $t/wc/dir
svn add -q --no-auto-props $t/wc/dir
svn ci -mx $t/wc/dir
@@ -110,7 +110,7 @@
svn ci -mx $t/wc/preregexsuf/no
EOS
-work_nok('deny else', 'a FILE should be a DIRECTORY in', <<"EOS");
+work_nok('deny else', 'the component (else) should be a DIR in', <<"EOS");
touch $t/wc/else
svn add -q --no-auto-props $t/wc/else
svn ci -mx $t/wc/else
More information about the Pkg-perl-cvs-commits
mailing list