r33141 - in /branches/upstream/libsvn-hooks-perl/current: ./ lib/SVN/ lib/SVN/Hooks/ t/
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Mon Apr 13 12:56:00 UTC 2009
Author: angelabad-guest
Date: Mon Apr 13 12:55:55 2009
New Revision: 33141
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=33141
Log:
[svn-upgrade] Integrating new upstream version, libsvn-hooks-perl (0.16.52)
Added:
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowPropChange.pm
branches/upstream/libsvn-hooks-perl/current/t/02-allowpropchange.t (with props)
Modified:
branches/upstream/libsvn-hooks-perl/current/Changes
branches/upstream/libsvn-hooks-perl/current/MANIFEST
branches/upstream/libsvn-hooks-perl/current/META.yml
branches/upstream/libsvn-hooks-perl/current/README
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowLogChange.pm
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckProperty.pm
branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckStructure.pm
branches/upstream/libsvn-hooks-perl/current/t/00-load.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=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/Changes (original)
+++ branches/upstream/libsvn-hooks-perl/current/Changes Mon Apr 13 12:55:55 2009
@@ -1,4 +1,12 @@
Revision history for SVN-Hooks. -*- text -*-
+
+0.16 2009-04-12
+
+ Implements the AllowPropChange plugin.
+
+ Better document the CheckProperty plugin.
+
+ Accepts relative paths in CHECK_STRUCTURE.
0.15 2009-03-12
Modified: branches/upstream/libsvn-hooks-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/MANIFEST?rev=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/MANIFEST (original)
+++ branches/upstream/libsvn-hooks-perl/current/MANIFEST Mon Apr 13 12:55:55 2009
@@ -2,6 +2,7 @@
Changes
lib/SVN/Hooks.pm
lib/SVN/Hooks/AllowLogChange.pm
+lib/SVN/Hooks/AllowPropChange.pm
lib/SVN/Hooks/CheckLog.pm
lib/SVN/Hooks/CheckMimeTypes.pm
lib/SVN/Hooks/CheckProperty.pm
@@ -18,11 +19,12 @@
README
t/00-load.t
t/02-allowlogchange.t
+t/02-allowpropchange.t
t/02-checklog.t
t/02-checkmimetypes.t
t/02-checkproperty.t
+t/02-checkstructurealone.t
t/02-checkstructure.t
-t/02-checkstructurealone.t
t/02-denychanges.t
t/02-denyfilenames.t
t/02-jiraacceptance.t
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=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/META.yml (original)
+++ branches/upstream/libsvn-hooks-perl/current/META.yml Mon Apr 13 12:55:55 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: SVN-Hooks
-version: 0.15.41
+version: 0.16.52
abstract: A framework for implementing Subversion hooks.
license: ~
author:
Modified: branches/upstream/libsvn-hooks-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/README?rev=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/README (original)
+++ branches/upstream/libsvn-hooks-perl/current/README Mon Apr 13 12:55:55 2009
@@ -1,6 +1,6 @@
Name: SVN-Hooks
What: Framework for Subversion hooks
-Version: 0.15
+Version: 0.16
Author: Gustavo Chaves <gnustavo at cpan.org>
SVN-Hooks is a framework for creating Subversion hooks
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=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm Mon Apr 13 12:55:55 2009
@@ -15,11 +15,11 @@
=head1 VERSION
-Version 0.15
+Version 0.16
=cut
-our $VERSION = '0.15.' . (q$Revision: 41 $ =~ / (\d+) /)[0]; # bump from 38
+our $VERSION = '0.16.' . (q$Revision: 52 $ =~ / (\d+) /)[0]; # bump from 48
=head1 SYNOPSIS
Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowLogChange.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowLogChange.pm?rev=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowLogChange.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowLogChange.pm Mon Apr 13 12:55:55 2009
@@ -18,6 +18,8 @@
This SVN::Hooks plugin is used to allow revision log changes by some
users.
+
+It's deprecated. You should use SVN::Hooks::AllowPropChange instead.
It's active in the C<pre-revprop-change> hook.
Added: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowPropChange.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowPropChange.pm?rev=33141&op=file
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowPropChange.pm (added)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/AllowPropChange.pm Mon Apr 13 12:55:55 2009
@@ -1,0 +1,177 @@
+package SVN::Hooks::AllowPropChange;
+
+use warnings;
+use strict;
+use SVN::Hooks;
+
+use Exporter qw/import/;
+my $HOOK = 'ALLOW_PROP_CHANGE';
+our @EXPORT = ($HOOK);
+
+our $VERSION = $SVN::Hooks::VERSION;
+
+=head1 NAME
+
+SVN::Hooks::AllowPropChange - Allow changes in revision properties.
+
+=head1 SYNOPSIS
+
+This SVN::Hooks plugin is used to allow revision (or non-versioned)
+properties (C<svn:author>, C<svn:date>, and C<svn:log>) to be changed
+by a group of users.
+
+It's active in the C<pre-revprop-change> hook.
+
+It's configured by the following directive.
+
+=head2 ALLOW_PROP_CHANGE(PROP => WHO, ...)
+
+This directive enables the change of revision properties.
+
+By default any change is denied unless explicitly allowed by the
+directive. You can use the directive more than once.
+
+The PROP argument specifies the propertie(s) that are to be configured
+depending on its type. If no argument is given, no user can change any
+property.
+
+=over
+
+=item STRING
+
+Specify a single property by name (C<author>, C<date>, or C<log>).
+
+=item REGEXP
+
+Specify all properties that match the Regexp.
+
+=back
+
+The optional WHO arguments specify the users that are allowed to make
+those changes. If absent, no user can change a log message. Otherwise,
+it specifies the allowed users depending on its type.
+
+=over
+
+=item STRING
+
+Specify a single user by name.
+
+=item REGEXP
+
+Specify the class of users whose names are matched by the Regexp.
+
+=back
+
+ ALLOW_PROP_CHANGE('svn:log' => 'jsilva'); # jsilva can change svn:log
+ ALLOW_PROP_CHANGE(qr/./ => qr/silva$/); # any *silva can change any property
+
+=cut
+
+sub ALLOW_PROP_CHANGE {
+ my $conf = $SVN::Hooks::Confs->{$HOOK};
+
+ my @whos;
+
+ foreach my $arg (@_) {
+ if (! ref $arg or ref $arg eq 'Regexp') {
+ push @whos, $arg;
+ }
+ else {
+ die "$HOOK: invalid argument '$arg'\n";
+ }
+ }
+
+ @whos != 0
+ or die "$HOOK: you must specify at least the first argument\n";
+
+ my $prop = shift @whos;
+ push @{$conf->{specs}}, [$prop => \@whos];
+ $conf->{'pre-revprop-change'} = \&pre_revprop_change;
+}
+
+$SVN::Hooks::Inits{$HOOK} = sub {
+ return { specs => [] };
+};
+
+sub pre_revprop_change {
+ my ($self, $rev, $author, $propname, $action) = @_;
+
+ $propname =~ /^svn:(?:author|date|log)$/
+ or die "$HOOK: the revision property $propname cannot be changed.\n";
+
+ $action eq 'M'
+ or die "$HOOK: revision properties can only be modified, not added or deleted.\n";
+
+ foreach my $spec (@{$self->{specs}}) {
+ my ($prop, $whos) = @$spec;
+ if (! ref $prop) {
+ next if $propname ne $prop;
+ }
+ else {
+ next if $propname !~ $prop;
+ }
+ for my $who (@$whos) {
+ if (! ref $who) {
+ return if $author eq $who;
+ }
+ else {
+ return if $author =~ $who;
+ }
+ }
+ }
+
+ die "$HOOK: you are not allowed to change property $propname.\n";
+}
+
+=head1 AUTHOR
+
+Gustavo Chaves, C<< <gnustavo at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-svn-hooks-checkproperty at rt.cpan.org>, or through the web
+interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Hooks>. I will
+be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+ perldoc SVN::Hooks
+
+You can also look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Hooks>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/SVN-Hooks>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/SVN-Hooks>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/SVN-Hooks>
+
+=back
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2009 CPqD, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1; # End of SVN::Hooks::AllowPropChange
Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckProperty.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckProperty.pm?rev=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckProperty.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckProperty.pm Mon Apr 13 12:55:55 2009
@@ -34,8 +34,30 @@
The PROPERTY argument is the name of the property that must be set for
the files matching WHERE.
-The VALUE argument is an optional STRING. Use it to require a specific
-value for PROPERTY.
+The optional VALUE argument specifies the value for PROPERTY depending
+on its type:
+
+=over
+
+=item UNDEF or not present
+
+The PROPERTY must be set.
+
+=item NUMBER
+
+If non-zero, the PROPERTY must be set. If zero, the PROPERTY must NOT be set.
+
+=item STRING
+
+The PROPERTY must be set with a value equal to the string.
+
+=item qr/Regexp/
+
+The PROPERTY must be set with a value that matches the Regexp.
+
+=back
+
+Example:
CHECK_PROPERTY(qr/\.(?:do[ct]|od[bcfgimpst]|ot[ghpst]|pp[st]|xl[bst])$/i
=> 'svn:needs-lock');
Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckStructure.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckStructure.pm?rev=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckStructure.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckStructure.pm Mon Apr 13 12:55:55 2009
@@ -214,7 +214,7 @@
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.)
+module and use that module here. We'll take care of that eventually.)
The function check_structure takes two arguments. The first is a
STRUCT_DEF exactly the same as specified for the CHECK_STRUCTURE
@@ -224,13 +224,19 @@
The function returns true if the check succeeds and dies with a proper
message otherwise.
+The funcion is intended to check paths as they're shown by the 'svn
+ls' command, i.e., with no leading slashes and with a trailing slash
+to indicate directories. The leading slash is assumed if it's missing,
+but the trailing slash is needed to indicate directories.
+
=cut
sub check_structure {
my ($structure, $path) = @_;
+ $path = "/$path" unless $path =~ m@^/@; # make sure it's an absolute path
my @path = split '/', $path, -1; # preserve trailing empty components
my ($code, $error) = _check_structure($structure, \@path);
- die "$path: $error\n" if $code == 0;
+ die "$error: $path\n" if $code == 0;
1;
}
@@ -298,7 +304,7 @@
=head1 COPYRIGHT & LICENSE
-Copyright 2008 CPqD, all rights reserved.
+Copyright 2008-2009 CPqD, all rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Modified: branches/upstream/libsvn-hooks-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/t/00-load.t?rev=33141&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/t/00-load.t (original)
+++ branches/upstream/libsvn-hooks-perl/current/t/00-load.t Mon Apr 13 12:55:55 2009
@@ -15,14 +15,17 @@
my $t = reset_repo();
set_hook(<<'EOS');
-use SVN::Hooks::CheckMimeTypes;
-use SVN::Hooks::DenyChanges;
+use SVN::Hooks::AllowLogChange;
+use SVN::Hooks::AllowPropChange;
+use SVN::Hooks::CheckLog;
use SVN::Hooks::CheckMimeTypes;
use SVN::Hooks::CheckProperty;
use SVN::Hooks::CheckStructure;
+use SVN::Hooks::DenyChanges;
use SVN::Hooks::DenyFilenames;
use SVN::Hooks::JiraAcceptance;
use SVN::Hooks::Mailer;
+use SVN::Hooks::Notify;
use SVN::Hooks::UpdateConfFile;
EOS
Added: branches/upstream/libsvn-hooks-perl/current/t/02-allowpropchange.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/t/02-allowpropchange.t?rev=33141&op=file
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/t/02-allowpropchange.t (added)
+++ branches/upstream/libsvn-hooks-perl/current/t/02-allowpropchange.t Mon Apr 13 12:55:55 2009
@@ -1,0 +1,82 @@
+use strict;
+use warnings;
+use lib 't';
+use Test::More;
+
+require "test-functions.pl";
+
+if (has_svn()) {
+ plan tests => 8;
+}
+else {
+ plan skip_all => 'Need svn commands in the PATH.';
+}
+
+my $t = reset_repo();
+chomp(my $cwd = `pwd`);
+my $repo = "file://$t/repo";
+
+set_hook(<<'EOS');
+use SVN::Hooks::AllowPropChange;
+EOS
+
+work_ok('setup', <<"EOS");
+touch $t/wc/file
+svn add -q --no-auto-props $t/wc/file
+svn ci -mx $t/wc/file
+EOS
+
+set_conf(<<'EOS');
+ALLOW_PROP_CHANGE({});
+EOS
+
+work_nok('invalid argument' => 'ALLOW_PROP_CHANGE: invalid argument', <<"EOS");
+svn ps svn:log --revprop -r 1 message $repo
+EOS
+
+set_conf(<<"EOS");
+ALLOW_PROP_CHANGE(qr/./);
+EOS
+
+work_nok('unknowk property' => 'ALLOW_PROP_CHANGE: the revision property svn:xpto cannot be changed.', <<"EOS");
+svn ps svn:xpto --revprop -r 1 value $repo
+EOS
+
+work_nok('cannot delete' => 'ALLOW_PROP_CHANGE: revision properties can only be modified, not added or deleted.', <<"EOS");
+svn pd svn:log --revprop -r 1 $repo
+EOS
+
+my $username = getpwuid($<);
+
+set_conf(<<"EOS");
+ALLOW_PROP_CHANGE('svn:log' => 'x$username');
+EOS
+
+work_nok('deny user' => 'ALLOW_PROP_CHANGE: you are not allowed to change property svn:log.', <<"EOS");
+svn ps svn:log --revprop -r 1 value $repo
+EOS
+
+set_conf(<<"EOS");
+ALLOW_PROP_CHANGE('svn:log' => $username);
+EOS
+
+work_ok('can modify', <<"EOS");
+svn ps svn:log --revprop -r 1 value $repo
+EOS
+
+set_conf(<<"EOS");
+ALLOW_PROP_CHANGE('svn:log' => qr/./);
+EOS
+
+work_ok('can modify with regexp', <<"EOS");
+svn ps svn:log --revprop -r 1 value2 $repo
+EOS
+
+set_conf(<<'EOS');
+ALLOW_PROP_CHANGE(qr/./ => qr/^,/);
+EOS
+
+work_nok('deny user with regexp' => 'ALLOW_PROP_CHANGE: you are not allowed to change property svn:log.', <<"EOS");
+svn ps svn:log --revprop -r 1 value3 $repo
+EOS
+
Propchange: branches/upstream/libsvn-hooks-perl/current/t/02-allowpropchange.t
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-perl-cvs-commits
mailing list