r77226 - in /branches/upstream/libsvn-hooks-perl/current: Changes META.yml README lib/SVN/Hooks.pm lib/SVN/Hooks/CheckJira.pm lib/SVN/Hooks/UpdateConfFile.pm t/02-checkjira.t

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Fri Jul 8 12:46:10 UTC 2011


Author: angelabad-guest
Date: Fri Jul  8 12:46:06 2011
New Revision: 77226

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

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/CheckJira.pm
    branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/UpdateConfFile.pm
    branches/upstream/libsvn-hooks-perl/current/t/02-checkjira.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=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/Changes (original)
+++ branches/upstream/libsvn-hooks-perl/current/Changes Fri Jul  8 12:46:06 2011
@@ -1,4 +1,14 @@
 Revision history for SVN-Hooks. -*- text -*-
+
+0.91	2011-07-07
+
+	CHECK_JIRA_CONFIG accepts a fifth argument to match JIRA
+	project keys.
+
+	Fixes an error on UpdateConfFile.
+
+	Configuration files should be optional, but they were always
+	required. Now it's fixed.
 
 0.90	2011-05-14
 

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=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/META.yml (original)
+++ branches/upstream/libsvn-hooks-perl/current/META.yml Fri Jul  8 12:46:06 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               SVN-Hooks
-version:            0.90
+version:            0.91
 abstract:           A framework for implementing Subversion hooks.
 author:
     - Gustavo Chaves <gnustavo at cpan.org>

Modified: branches/upstream/libsvn-hooks-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/README?rev=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/README (original)
+++ branches/upstream/libsvn-hooks-perl/current/README Fri Jul  8 12:46:06 2011
@@ -1,6 +1,6 @@
 Name:    SVN-Hooks
 What:    Framework for Subversion hooks
-Version: 0.90
+Version: 0.91
 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=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks.pm Fri Jul  8 12:46:06 2011
@@ -17,11 +17,11 @@
 
 =head1 VERSION
 
-Version 0.90
+Version 0.91
 
 =cut
 
-our $VERSION = '0.90';
+our $VERSION = '0.91';
 
 our @Conf_Files = ('conf/svn-hooks.conf');
 our $Repo       = undef;
@@ -38,6 +38,7 @@
 
     # Reload all configuration files
     foreach my $conf (@Conf_Files) {
+	next unless -e "$Repo/$conf"; # Configuration files are optional
 	package main;
 	unless (my $return = do "$Repo/$conf") {
 	    die "couldn't parse '$Repo/$conf': $@\n" if $@;
@@ -147,14 +148,14 @@
 	use SVN::Hooks;
 
 	START_COMMIT {
-	my ($repo_path, $username, $capabilities) = @_;
+	    my ($repo_path, $username, $capabilities) = @_;
 	    # ...
-	}
+	};
 
 	PRE_COMMIT {
 	    my ($svnlook) = @_;
 	    # ...
-	}
+	};
 
 	run_hook($0, @ARGV);
 
@@ -193,7 +194,7 @@
 
 A hook is a specifically named program that is called by the
 Subversion server during the execution of some operations. There are
-exactly nine hooks which must reside under the C<conf> directory in
+exactly nine hooks which must reside under the C<hooks> directory in
 the repository. When you create a new repository, you get nine
 template files in this directory, all of them having the C<.tmpl>
 suffix and helpful instructions inside explaining how to convert them

Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckJira.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckJira.pm?rev=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckJira.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/CheckJira.pm Fri Jul  8 12:46:06 2011
@@ -29,7 +29,7 @@
 
 It's configured by the following directives.
 
-=head2 CHECK_JIRA_CONFIG(BASEURL, LOGIN, PASSWORD, [REGEXP])
+=head2 CHECK_JIRA_CONFIG(BASEURL, LOGIN, PASSWORD [, REGEXP [, REGEXP]])
 
 This directive specifies how to connect and to authenticate to the
 JIRA server. BASEURL is the base URL of the JIRA server, usually,
@@ -37,15 +37,22 @@
 the credentials of a JIRA user who has browsing rights to the JIRA
 projects that will be referenced in the commit logs.
 
-The fourth argument is optional. It must be a qr/Regexp/ object that
-will be used to match against the commit logs in order to extract the
-list of JIRA issue keys. By default, the JIRA keys are looked for in
-the whole commit log. Sometimes this can be suboptimal because the
-user can introduce in the message some text that inadvertently looks
-like a JIRA issue key whithout being so. With this argument, the log
-message is matched against the REGEXP and only the first matched group
-(i.e., the part of the message captured by the first parenthesis
-(C<$1>)) is used to look for JIRA issue keys.
+The fourth argument is an optional qr/Regexp/ object. It will be used
+to match against the commit logs in order to extract the list of JIRA
+issue keys. By default, the JIRA keys are looked for in the whole
+commit log, which is equivalent to qr/(.*)/. Sometimes this can be
+suboptimal because the user can introduce in the message some text
+that inadvertently looks like a JIRA issue key whithout being so. With
+this argument, the log message is matched against the REGEXP and only
+the first matched group (i.e., the part of the message captured by the
+first parenthesis (C<$1>)) is used to look for JIRA issue keys.
+
+The fifth argument is another optional qr/Regexp/ object. It is used
+to match JIRA project keys, which match qr/[A-Z]{2,}/ by
+default. However, since you can specify different patterns for JIRA
+project keys
+(L<http://confluence.atlassian.com/display/JIRA/Configuring+Project+Keys>),
+you need to be able to specify this here too.
 
 The JIRA issue keys are extracted from the commit log (or the part of
 it specified by the REGEXP) with the following pattern:
@@ -53,7 +60,7 @@
 
 =cut
 
-my ($BaseURL, $Login, $Passwd, $Match);
+my ($BaseURL, $Login, $Passwd, $MatchLog, $MatchKey);
 my $JIRA;
 my @Checks;
 my %Defaults = (
@@ -64,18 +71,24 @@
 );
 
 sub CHECK_JIRA_CONFIG {
-    ($BaseURL, $Login, $Passwd, $Match) = @_;
-
-    if (@_ == 3) {
-	$Match = qr/(.*)/;
-    }
-    elsif (@_ == 4) {
-	ref $Match eq 'Regexp'
+    ($BaseURL, $Login, $Passwd, $MatchLog, $MatchKey) = @_;
+
+    if (defined $MatchKey) {
+	ref $MatchKey && ref $MatchKey eq 'Regexp'
+	    or croak "CHECK_JIRA_CONFIG: fifth argument must be a Regexp.\n";
+    } else {
+	$MatchKey = qr/[A-Z]{2,}/;
+    }
+
+    if (defined $MatchLog) {
+	ref $MatchLog && ref $MatchLog eq 'Regexp'
 	    or croak "CHECK_JIRA_CONFIG: fourth argument must be a Regexp.\n";
-    }
-    else {
-	croak "CHECK_JIRA_CONFIG: requires three or four arguments.\n";
-    }
+    } else {
+	$MatchLog = qr/[A-Z]{2,}/;
+    }
+
+    @_ >= 3 && @_ <= 5
+	or croak "CHECK_JIRA_CONFIG: requires three, four, or five arguments.\n";
 
     $BaseURL =~ s/\/+$//;
 
@@ -337,8 +350,8 @@
 	    if ($file =~ $regex) {
 
 		# Grok the JIRA issue keys from the commit log
-		my ($match) = ($svnlook->log_msg() =~ $Match);
-		my @keys    = defined $match ? $match =~ /\b[A-Z]+-\d+\b/g : ();
+		my ($match) = ($svnlook->log_msg() =~ $MatchLog);
+		my @keys    = defined $match ? $match =~ /\b$MatchKey-\d+\b/g : ();
 
 		my %opts = (%Defaults, %$opts);
 

Modified: branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/UpdateConfFile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/UpdateConfFile.pm?rev=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/UpdateConfFile.pm (original)
+++ branches/upstream/libsvn-hooks-perl/current/lib/SVN/Hooks/UpdateConfFile.pm Fri Jul  8 12:46:06 2011
@@ -339,7 +339,7 @@
 	close $th;
 
 	local $ENV{SVNREPOPATH} = $repo_path;
-	if (system("$cmd $temp/file 1>$temp/output 2>$temp/error") == 0) {
+	if (system("$cmd $temp/file $path 1>$temp/output 2>$temp/error") == 0) {
 	    return `cat $temp/output`;
 	}
 	else {

Modified: branches/upstream/libsvn-hooks-perl/current/t/02-checkjira.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-hooks-perl/current/t/02-checkjira.t?rev=77226&op=diff
==============================================================================
--- branches/upstream/libsvn-hooks-perl/current/t/02-checkjira.t (original)
+++ branches/upstream/libsvn-hooks-perl/current/t/02-checkjira.t Fri Jul  8 12:46:06 2011
@@ -40,7 +40,7 @@
 CHECK_JIRA_CONFIG();
 EOS
 
-work_nok('config sans args', 'CHECK_JIRA_CONFIG: requires three or four arguments', work(''));
+work_nok('config sans args', 'CHECK_JIRA_CONFIG: requires three, four, or five arguments', work(''));
 
 set_conf(<<'EOS');
 CHECK_JIRA_CONFIG('http://jira.atlassian.com/', 'user', 'pass', 'asdf');




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