3 eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
4 if 0; # not running under some shell
16 use List
::MoreUtils qw
/uniq/;
21 getopts
('',\
%opt) or pod2usage
(1);
23 my ($repos_path) = @ARGV;
25 #check the repos path we were given
26 $repos_path or pod2usage
(1);
27 -d
$repos_path or die "repo path does not exist";
28 -f
"$repos_path/format" && -d
"$repos_path/hooks" && -d
"$repos_path/conf"
29 or die "'$repos_path' does not appear to be a valid svn repository.\n";
31 my $conf_dir = "$repos_path/conf";
32 my $conf_file = "$FindBin::RealBin/svn-hooks.conf";
33 my $conf_tgt = "$conf_dir/svn-hooks.conf";
34 my $hook_script = "$FindBin::RealBin/svn-hooks.pl";
35 my $hook_dir = "$repos_path/hooks";
37 (map { s/\.tmpl$//; $_} glob "$hook_dir/*.tmpl"),
38 (map {"$repos_path/hooks/$_"} qw
/pre-commit post-commit pre-revprop-change/);
41 -f
$conf_file or die "conf file '$conf_file' not found, aborting";
42 -f
$hook_script or die "hook script '$hook_script' not found, aborting";
43 -w
or die "could not write to '$_'" foreach $conf_dir, $hook_dir;
46 symlink($conf_file, $conf_tgt) or die "$! linking '$conf_file' -> '$conf_tgt'";
48 foreach my $t (@hook_tgts) {
50 symlink( $hook_script, $t ) or die "$! linking '$hook_script' -> '$t'";
60 install_hooks.pl - tiny script to just install the accompanying svn
61 hooks and configuration into the SVN repository at the given path
65 install_hooks.pl [options] repos_path