The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 07
META.yml 11
Makefile.PL 11
lib/SVN/Hooks/AllowLogChange.pm 22
lib/SVN/Hooks/AllowPropChange.pm 22
lib/SVN/Hooks/CheckCapability.pm 22
lib/SVN/Hooks/CheckJira.pm 22
lib/SVN/Hooks/CheckLog.pm 22
lib/SVN/Hooks/CheckMimeTypes.pm 22
lib/SVN/Hooks/CheckProperty.pm 22
lib/SVN/Hooks/CheckStructure.pm 22
lib/SVN/Hooks/DenyChanges.pm 22
lib/SVN/Hooks/DenyFilenames.pm 22
lib/SVN/Hooks/Generic.pm 22
lib/SVN/Hooks/JiraAcceptance.pm 22
lib/SVN/Hooks/Mailer.pm 22
lib/SVN/Hooks/Notify.pm 22
lib/SVN/Hooks/UpdateConfFile.pm 1016
lib/SVN/Hooks.pm 33
t/02-updateconffile.t 615
20 files changed (This is a version diff) 4971
@@ -1,5 +1,12 @@
 Revision history for SVN-Hooks. -*- text -*-
 
+1.25      2014-04-13 16:50:07 America/Sao_Paulo
+
+        [Fixes]
+
+        - UpdateConfFile: the specification of a subdirectory as the
+          destination file wasn't working.
+
 1.24      2014-03-16 23:31:06 America/Sao_Paulo
 
         [Fixes]
@@ -35,4 +35,4 @@ resources:
   bugtracker: https://github.com/gnustavo/SVN-Hooks/issues
   homepage: http://search.cpan.org/dist/SVN-Hooks/
   repository: git://github.com/gnustavo/SVN-Hooks.git
-version: 1.24
+version: 1.25
@@ -41,7 +41,7 @@ my %WriteMakefileArgs = (
     "URI::file" => 0,
     "lib" => 0
   },
-  "VERSION" => "1.24",
+  "VERSION" => "1.25",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::AllowLogChange;
 {
-  $SVN::Hooks::AllowLogChange::VERSION = '1.24';
+  $SVN::Hooks::AllowLogChange::VERSION = '1.25';
 }
 # ABSTRACT: Allow changes in revision log messages.
 
@@ -67,7 +67,7 @@ SVN::Hooks::AllowLogChange - Allow changes in revision log messages.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::AllowPropChange;
 {
-  $SVN::Hooks::AllowPropChange::VERSION = '1.24';
+  $SVN::Hooks::AllowPropChange::VERSION = '1.25';
 }
 # ABSTRACT: Allow changes in revision properties.
 
@@ -84,7 +84,7 @@ SVN::Hooks::AllowPropChange - Allow changes in revision properties.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::CheckCapability;
 {
-  $SVN::Hooks::CheckCapability::VERSION = '1.24';
+  $SVN::Hooks::CheckCapability::VERSION = '1.25';
 }
 # ABSTRACT: Check the svn client capabilities.
 
@@ -58,7 +58,7 @@ SVN::Hooks::CheckCapability - Check the svn client capabilities.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::CheckJira;
 {
-  $SVN::Hooks::CheckJira::VERSION = '1.24';
+  $SVN::Hooks::CheckJira::VERSION = '1.25';
 }
 # ABSTRACT: Integrate Subversion with the JIRA ticketing system.
 
@@ -242,7 +242,7 @@ SVN::Hooks::CheckJira - Integrate Subversion with the JIRA ticketing system.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 DESCRIPTION
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::CheckLog;
 {
-  $SVN::Hooks::CheckLog::VERSION = '1.24';
+  $SVN::Hooks::CheckLog::VERSION = '1.25';
 }
 # ABSTRACT: Check log messages in commits.
 
@@ -62,7 +62,7 @@ SVN::Hooks::CheckLog - Check log messages in commits.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::CheckMimeTypes;
 {
-  $SVN::Hooks::CheckMimeTypes::VERSION = '1.24';
+  $SVN::Hooks::CheckMimeTypes::VERSION = '1.25';
 }
 # ABSTRACT: Require the svn:mime-type property.
 
@@ -85,7 +85,7 @@ SVN::Hooks::CheckMimeTypes - Require the svn:mime-type property.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::CheckProperty;
 {
-  $SVN::Hooks::CheckProperty::VERSION = '1.24';
+  $SVN::Hooks::CheckProperty::VERSION = '1.25';
 }
 # ABSTRACT: Check properties in added files.
 
@@ -90,7 +90,7 @@ SVN::Hooks::CheckProperty - Check properties in added files.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::CheckStructure;
 {
-  $SVN::Hooks::CheckStructure::VERSION = '1.24';
+  $SVN::Hooks::CheckStructure::VERSION = '1.25';
 }
 # ABSTRACT: Check the structure of a repository.
 
@@ -129,7 +129,7 @@ SVN::Hooks::CheckStructure - Check the structure of a repository.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::DenyChanges;
 {
-  $SVN::Hooks::DenyChanges::VERSION = '1.24';
+  $SVN::Hooks::DenyChanges::VERSION = '1.25';
 }
 # ABSTRACT: Deny some changes in a repository.
 
@@ -117,7 +117,7 @@ SVN::Hooks::DenyChanges - Deny some changes in a repository.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::DenyFilenames;
 {
-  $SVN::Hooks::DenyFilenames::VERSION = '1.24';
+  $SVN::Hooks::DenyFilenames::VERSION = '1.25';
 }
 # ABSTRACT: Deny some file names.
 
@@ -101,7 +101,7 @@ SVN::Hooks::DenyFilenames - Deny some file names.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::Generic;
 {
-  $SVN::Hooks::Generic::VERSION = '1.24';
+  $SVN::Hooks::Generic::VERSION = '1.25';
 }
 # ABSTRACT: Implement generic checks for all Subversion hooks.
 
@@ -55,7 +55,7 @@ SVN::Hooks::Generic - Implement generic checks for all Subversion hooks.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::JiraAcceptance;
 {
-  $SVN::Hooks::JiraAcceptance::VERSION = '1.24';
+  $SVN::Hooks::JiraAcceptance::VERSION = '1.25';
 }
 # ABSTRACT: Integrate Subversion with the JIRA ticketing system.
 
@@ -150,7 +150,7 @@ SVN::Hooks::JiraAcceptance - Integrate Subversion with the JIRA ticketing system
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::Mailer;
 {
-  $SVN::Hooks::Mailer::VERSION = '1.24';
+  $SVN::Hooks::Mailer::VERSION = '1.25';
 }
 # ABSTRACT: Send emails after successful commits.
 
@@ -50,7 +50,7 @@ SVN::Hooks::Mailer - Send emails after successful commits.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::Notify;
 {
-  $SVN::Hooks::Notify::VERSION = '1.24';
+  $SVN::Hooks::Notify::VERSION = '1.25';
 }
 # ABSTRACT: Subversion activity notification.
 
@@ -63,7 +63,7 @@ SVN::Hooks::Notify - Subversion activity notification.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -3,7 +3,7 @@ use warnings;
 
 package SVN::Hooks::UpdateConfFile;
 {
-  $SVN::Hooks::UpdateConfFile::VERSION = '1.24';
+  $SVN::Hooks::UpdateConfFile::VERSION = '1.25';
 }
 # ABSTRACT: Maintain the repository configuration versioned.
 
@@ -136,7 +136,7 @@ EOS
 
             # Create the directory where $to is to be created, if it doesn't
             # already exist.
-            my $todir = (File::Spec->splitpath($to))[2];
+            my $todir = (File::Spec->splitpath($to))[1];
             unless (-d $todir) {
                 require File::Path;
                 File::Path::make_path($todir);
@@ -227,25 +227,27 @@ sub _post_where_to {
         $to = eval qq{"$to"};   ## no critic
     }
 
-    $to = abs_path(catfile($absbase, $to));
-    if (-d $to) {
-        $to = catfile($to, (File::Spec->splitpath($file))[2]);
+    my $is_directory = ($to =~ s:/$::);
+
+    my $abs_to = abs_path(catfile($absbase, $to));
+    if ($is_directory || -d $abs_to) {
+        $abs_to = catfile($abs_to, (File::Spec->splitpath($file))[2]);
     }
 
-    $absbase eq substr($to, 0, length($absbase))
+    $absbase eq substr($abs_to, 0, length($absbase))
         or croak <<"EOS";
 $HOOK: post-commit aborted for: $file
 
 This means that $file was committed but the associated
 configuration file wasn't generated because its specified
-location ($to)
+location ($abs_to)
 isn't below the repository's configuration directory
 ($absbase).
 
 Please, correct the ${HOOK}'s second argument.
 EOS
 
-    return $to;
+    return $abs_to;
 }
 
 # Rotates file $to $rotate times.
@@ -274,7 +276,7 @@ SVN::Hooks::UpdateConfFile - Maintain the repository configuration versioned.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -305,9 +307,13 @@ to the repository's root (e.g. "trunk/src/version.c" or
 
 TO is a path relative to the C</repo/conf> directory in the server. It can be
 an explicit file name or a directory, in which case the basename of FROM is
-used as the name of the destination file. Non-existing diredtory components of
+used as the name of the destination file. Non-existing directory components of
 TO are automatically created.
 
+Note that if the path doesn't exist the hook assumes that it should be a
+file. To make sure it's understood as a directory you may end it with a
+forward slash (/).
+
 If FROM is a qr/Regexp/, TO is evaluated as a string in order to allow
 for the interpolation of capture buffers from the regular
 expression. This is useful to map the copy operation to a diferent
@@ -3,7 +3,7 @@ use strict;
 
 package SVN::Hooks;
 {
-  $SVN::Hooks::VERSION = '1.24';
+  $SVN::Hooks::VERSION = '1.25';
 }
 # ABSTRACT: A framework for implementing Subversion hooks.
 
@@ -37,7 +37,7 @@ sub run_hook {
 	next unless -e $conffile; # Configuration files are optional
 	package main;
 {
-  $main::VERSION = '1.24';
+  $main::VERSION = '1.25';
 }
 	unless (my $return = do $conffile) {
 	    die "couldn't parse '$conffile': $@\n" if $@;
@@ -152,7 +152,7 @@ SVN::Hooks - A framework for implementing Subversion hooks.
 
 =head1 VERSION
 
-version 1.24
+version 1.25
 
 =head1 SYNOPSIS
 
@@ -8,7 +8,7 @@ use Test::More;
 require "test-functions.pl";
 
 if (can_svn()) {
-    plan tests => 17;
+    plan tests => 18;
 }
 else {
     plan skip_all => 'Cannot find or use svn commands.';
@@ -112,7 +112,7 @@ my $cmp = catfile($t, 'cmp.pl');
     open my $fh, '>', $cmp or die "Can't open '$cmp' for writing: $!\n";
     print $fh <<'EOS';
 use File::Compare;
-compare(@ARGV);
+exit compare(@ARGV);
 EOS
 }
 
@@ -159,7 +159,9 @@ $perl $cmp $generated $cgenerate
 EOS
 
 my $config = <<'EOS';
-UPDATE_CONF_FILE(subfile => 'subdir');
+UPDATE_CONF_FILE(subfile => 'subdir/');
+
+UPDATE_CONF_FILE(outfile => '../outdir/');
 
 UPDATE_CONF_FILE(qr/^file(\d)$/ => '$1-file');
 
@@ -192,6 +194,16 @@ svn ci -mx $subfile
 $perl $cmp $subfile $csubfile
 EOS
 
+my $outfile = catfile($wc, 'outfile');
+my $coutfile = catfile($t, 'repo', 'outdir', 'outfile');
+
+work_nok('to outdir', '', <<"EOS");
+echo asdf >$outfile
+svn add -q --no-auto-props $outfile
+svn ci -mx $outfile
+$perl $cmp $outfile $coutfile
+EOS
+
 my $cfile1 = catfile($conf, '1-file');
 
 work_ok('regexp', <<"EOS");
@@ -240,9 +252,6 @@ svn delete -q $unremoveable $removeable
 svn ci -mx $wc
 EOS
 
-#diag("wc: $wc; conf: $conf; $cunremoveable; $cremoveable");
-#system('bash');
-
 ok(! -f $cremoveable, 'remove conf');
 
 ok(-f $cunremoveable, 'do not remove conf by default');