r54019 - in /branches/upstream/libsvn-hooks-perl/current: Changes META.yml README lib/SVN/Hooks.pm lib/SVN/Hooks/DenyChanges.pm t/02-denychanges.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Wed Mar 10 01:13:05 UTC 2010


Author: jawnsy-guest
Date: Wed Mar 10 01:12:59 2010
New Revision: 54019

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54019
Log:
[svn-upgrade] Integrating new upstream version, libsvn-hooks-perl (0.26)

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/lib/SVN/Hooks.pm
    branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyChanges.pm
    branches/upstream/libsvn-hooks-perl/current/t/02-denychanges.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=54019&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/Changes (original)
+++ branches/upstream/libsvn-hooks-perl/current/Changes Wed Mar 10 01:12:59 2010
@@ -1,6 +1,10 @@
 Revision history for SVN-Hooks. -*- text -*-
 
-0.24    2010-01-19
+0.26    2010-03-08
+
+	Implements the DENY_EXEMP_USERS directive in DenyChanges.
+
+0.25    2010-01-19
 
 	Add a 'post_action' pseudo-check to CheckJira so that the
 	plugin can perform an action during the post-commit hook

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=54019&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/META.yml (original)
+++ branches/upstream/libsvn-hooks-perl/current/META.yml Wed Mar 10 01:12:59 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                SVN-Hooks
-version:             0.25
+version:             0.26
 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=54019&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/README (original)
+++ branches/upstream/libsvn-hooks-perl/current/README Wed Mar 10 01:12:59 2010
@@ -1,6 +1,6 @@
 Name:    SVN-Hooks
 What:    Framework for Subversion hooks
-Version: 0.25
+Version: 0.26
 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=54019&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm Wed Mar 10 01:12:59 2010
@@ -15,11 +15,11 @@
 
 =head1 VERSION
 
-Version 0.25
+Version 0.26
 
 =cut
 
-our $VERSION = '0.25';
+our $VERSION = '0.26';
 
 =head1 SYNOPSIS
 

Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyChanges.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyChanges.pm?rev=54019&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyChanges.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/DenyChanges.pm Wed Mar 10 01:12:59 2010
@@ -7,7 +7,7 @@
 
 use Exporter qw/import/;
 my $HOOK = 'DENY_CHANGES';
-my @HOOKS = ('DENY_ADDITION', 'DENY_DELETION', 'DENY_UPDATE');
+my @HOOKS = ('DENY_ADDITION', 'DENY_DELETION', 'DENY_UPDATE', 'DENY_EXEMPT_USERS');
 our @EXPORT = @HOOKS;
 
 our $VERSION = $SVN::Hooks::VERSION;
@@ -45,6 +45,15 @@
 passed as arguments.
 
 	DENY_UPDATE(qr/^tags/); # Can't modify tags
+
+=head2 DENY_EXCEMPT_USERS(LIST)
+
+This directive receives a list of user names which are to be exempt
+from the rules specified by the other directives.
+
+	DENY_EXEMPT_USERS(qw/john mary/);
+
+This rule exempts users C<john> and C<mary> from the other deny rules.
 
 =cut
 
@@ -65,33 +74,49 @@
 
 sub DENY_ADDITION {
     my @args = @_;
-    return _deny_change(deny_add    => @args);
+    return _deny_change(add    => @args);
 }
 
 sub DENY_DELETION {
     my @args = @_;
-    return _deny_change(deny_delete => @args);
+    return _deny_change(delete => @args);
 }
 
 sub DENY_UPDATE {
     my @args = @_;
-    return _deny_change(deny_update => @args);
+    return _deny_change(update => @args);
+}
+
+sub DENY_EXEMPT_USERS {
+    my @users = @_;
+    my $conf = $SVN::Hooks::Confs->{$HOOK};
+    foreach my $user (@users) {
+	croak "DENY_EXEMPT_USERS: all arguments must be strings\n"
+	    if ref $user;
+	$conf->{exempt}{$user} = undef;
+    }
+
+    return 1;
 }
 
 $SVN::Hooks::Inits{$HOOK} = sub {
     return {
-	deny_add    => [],
-	deny_delete => [],
-	deny_update => [],
+	add    => [],
+	delete => [],
+	update => [],
+	exempt => {},
     };
 };
 
 sub pre_commit {
     my ($self, $svnlook) = @_;
 
+    # Exempt users
+    return if %{$self->{exempt}} && exists $self->{exempt}{$svnlook->author()};
+
     my @errors;
 
-    foreach my $regex (@{$self->{deny_add}}) {
+    foreach my $regex (@{$self->{add}}) {
       ADDED:
 	foreach my $file ($svnlook->added()) {
 	    if ($file =~ $regex) {
@@ -101,7 +126,7 @@
 	}
     }
 
-    foreach my $regex (@{$self->{deny_delete}}) {
+    foreach my $regex (@{$self->{delete}}) {
       DELETED:
 	foreach my $file ($svnlook->deleted()) {
 	    if ($file =~ $regex) {
@@ -111,7 +136,7 @@
 	}
     }
 
-    foreach my $regex (@{$self->{deny_update}}) {
+    foreach my $regex (@{$self->{update}}) {
       UPDATED:
 	foreach my $file ($svnlook->updated()) {
 	    if ($file =~ $regex) {

Modified: branches/upstream/libsvn-hooks-perl/current/t/02-denychanges.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/t/02-denychanges.t?rev=54019&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/t/02-denychanges.t (original)
+++ branches/upstream/libsvn-hooks-perl/current/t/02-denychanges.t Wed Mar 10 01:12:59 2010
@@ -8,7 +8,7 @@
 require "test-functions.pl";
 
 if (has_svn()) {
-    plan tests => 8;
+    plan tests => 10;
 }
 else {
     plan skip_all => 'Need svn commands in the PATH.';
@@ -74,3 +74,25 @@
 svn ci -mx $t/wc/f
 EOS
 
+# Grok the author name
+my $author;
+open my $svn, '-|', "svn info $t/wc/del"
+    or die "Can't exec svn info\n";
+while (<$svn>) {
+    if (/Author: (.*)$/) {
+	$author = $1;
+    }
+}
+close $svn;
+ok(defined $author, 'grok author');
+
+set_conf(<<"EOS");
+DENY_ADDITION(qr/add/);
+DENY_EXEMPT_USERS($author);
+EOS
+
+work_ok('exempt user', <<"EOS");
+touch $t/wc/add
+svn add -q --no-auto-props $t/wc/add
+svn ci -mx $t/wc/add
+EOS




More information about the Pkg-perl-cvs-commits mailing list