line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVN::Hook::CLI; |
2
|
1
|
|
|
1
|
|
961
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use SVN::Hook; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub dispatch { |
7
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
8
|
0
|
0
|
|
|
|
|
my $cmd = shift or die "$0 version $SVN::Hook::VERSION.\n"; |
9
|
0
|
0
|
|
|
|
|
die if $cmd =~ m/^_/; |
10
|
0
|
0
|
|
|
|
|
my $func = $class->can($cmd) or die "no such command $cmd.\n"; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
$func->($class, @_); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub run { |
16
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
17
|
0
|
0
|
|
|
|
|
my $repospath = shift or die "repository required.\n"; |
18
|
0
|
0
|
|
|
|
|
my $hook = shift or die "hook name required.\n"; |
19
|
0
|
|
|
|
|
|
unshift @_, $class, $hook, $repospath; |
20
|
0
|
|
|
|
|
|
goto \&run; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _run { |
24
|
0
|
|
|
0
|
|
|
my $class = shift; |
25
|
0
|
|
|
|
|
|
my $hook = shift; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my ($repospath) = @_; |
28
|
0
|
|
|
|
|
|
my $h = SVN::Hook->new({repospath => $repospath}); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
$h->run_hook( $hook, @_ ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub init { |
34
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
35
|
0
|
0
|
|
|
|
|
my $repospath = shift or die "repository required.\n"; |
36
|
0
|
0
|
|
|
|
|
my @hooks = @_ ? @_ : SVN::Hook->ALL_HOOKS; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $h = SVN::Hook->new({repospath => $repospath}); |
39
|
0
|
|
|
|
|
|
$h->init($_) for @hooks; |
40
|
0
|
|
|
|
|
|
print "initialized.\n"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub list { |
44
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
45
|
0
|
0
|
|
|
|
|
my $repospath = shift or die "repository required.\n"; |
46
|
0
|
0
|
|
|
|
|
my $hook = shift or die "hook name required.\n"; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $h = SVN::Hook->new({repospath => $repospath}); |
49
|
0
|
|
|
|
|
|
my $i = 0; |
50
|
0
|
|
|
|
|
|
for my $script ($h->scripts($hook)) { |
51
|
0
|
|
|
|
|
|
printf '[%d] %s', ++$i, $script->path->basename; |
52
|
0
|
0
|
|
|
|
|
print " (disabled)" unless $script->enabled; |
53
|
0
|
|
|
|
|
|
print "\n"; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub status { |
58
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
59
|
0
|
0
|
|
|
|
|
my $repospath = shift or die "repository required.\n"; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $h = SVN::Hook->new({repospath => $repospath}); |
62
|
0
|
|
|
|
|
|
my $status = $h->status; |
63
|
0
|
|
|
|
|
|
for (sort SVN::Hook->ALL_HOOKS) { |
64
|
0
|
0
|
|
|
|
|
if (defined $status->{$_}) { |
65
|
0
|
|
|
|
|
|
print "$_: $status->{$_} scripts\n"; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else { |
68
|
0
|
|
|
|
|
|
print "svnhook not enabled for $_.\n"; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |