Hooks/CheckCapability.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 CC 2 SCAR 11.0
CC
2
Cov
0%
start_commit
6.0
CHECK_CAPABILITY
2.0
BEGIN
2.0
CRAP 3.0
1 package SVN::Hooks::CheckCapability;
2 # ABSTRACT: Check the svn client capabilities.
3 $SVN::Hooks::CheckCapability::VERSION = '1.35';
4 use strict;
5 use warnings;
6  
7 use Carp;
8 use SVN::Hooks;
9  
10 use Exporter qw/import/;
11 my $HOOK = 'CHECK_CAPABILITY';
12 our @EXPORT = ($HOOK);
13  
14  
15 my @Capabilities;
16  
17 sub CHECK_CAPABILITY {
18 push @Capabilities, @_;
19  
20 START_COMMIT(\&start_commit);
21  
22 return 1;
23 }
24  
25 sub start_commit {
26 my ($repo_path, $user, $capabilities, $txt_name) = @_;
27  
28 $capabilities ||= ''; # pre 1.5 svn clients don't pass the capabilities
29  
30 # Create a hash to facilitate the checks
31 my %supported;
32 @supported{split /:/, $capabilities} = undef;
33  
34 # Grok which required capabilities are missing
35 my @missing = grep {! exists $supported{$_}} @Capabilities;
36  
37 if (@missing) {
38 croak "$HOOK: Your subversion client does not support the following capabilities:\n\n\t",
39 join(', ', @missing),
40 "\n\nPlease, consider upgrading to a newer version of your client.\n";
41 }
42 }
43  
44 1; # End of SVN::Hooks::CheckCapability
45  
46 __END__