line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::MoreHooks::CheckCommitBase; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: CheckCommit base file |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.016'; # VERSION: generated by DZP::OurPkgVersion |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
794
|
use Git::Hooks 3.000000; |
|
1
|
|
|
|
|
66207
|
|
|
1
|
|
|
|
|
108
|
|
12
|
1
|
|
|
1
|
|
8
|
use Path::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
13
|
1
|
|
|
1
|
|
4
|
use Log::Any qw{$log}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
14
|
1
|
|
|
1
|
|
571
|
use Params::Validate qw(:all); |
|
1
|
|
|
|
|
2102
|
|
|
1
|
|
|
|
|
521
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $USER_HOOK; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import { |
19
|
1
|
|
|
1
|
|
3
|
my ( $package, $user_hook ) = @_; |
20
|
1
|
|
|
|
|
2
|
$package .= q{}; |
21
|
1
|
|
|
|
|
2
|
$USER_HOOK = $user_hook; |
22
|
1
|
|
|
|
|
24
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _call_user_hook { |
26
|
0
|
|
|
0
|
|
|
return &{$USER_HOOK}(@_); |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub pre_commit_callback { |
30
|
0
|
|
|
0
|
1
|
|
my ($git) = @_; |
31
|
0
|
|
|
|
|
|
my %opts = ( 'old_commit' => ':0', 'new_commit' => undef, 'gerrit-opts' => undef ); |
32
|
0
|
|
|
|
|
|
return _call_user_hook( $git, 'pre-commit', \%opts ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# This routine can act both as an update or a pre-receive hook. |
36
|
|
|
|
|
|
|
sub update_callback { |
37
|
0
|
|
|
0
|
1
|
|
$log->tracef( 'Entering update_callback(%s)', ( join q{:}, @_ ) ); |
38
|
0
|
|
|
|
|
|
my ($git) = @_; |
39
|
0
|
|
|
|
|
|
my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => undef ); |
40
|
0
|
|
|
|
|
|
return _call_user_hook( $git, 'update', \%opts ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub pre_receive_callback { |
44
|
0
|
|
|
0
|
1
|
|
$log->tracef( 'Entering pre_receive_callback(%s)', ( join q{:}, @_ ) ); |
45
|
0
|
|
|
|
|
|
my ($git) = @_; |
46
|
0
|
|
|
|
|
|
my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => undef ); |
47
|
0
|
|
|
|
|
|
return _call_user_hook( $git, 'pre-receive', \%opts ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub ref_update_callback { |
51
|
0
|
|
|
0
|
1
|
|
my ($git) = @_; |
52
|
0
|
|
|
|
|
|
my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => undef ); |
53
|
0
|
|
|
|
|
|
return _call_user_hook( $git, 'ref-update', \%opts ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub patchset_created_callback { |
57
|
0
|
|
|
0
|
1
|
|
my ( $git, $opts ) = @_; |
58
|
0
|
|
|
|
|
|
my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => $opts ); |
59
|
0
|
|
|
|
|
|
return _call_user_hook( $git, 'patchset-created', \%opts ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub draft_published_callback { |
63
|
0
|
|
|
0
|
1
|
|
my ( $git, $opts ) = @_; |
64
|
0
|
|
|
|
|
|
my %opts = ( 'old_commit' => ':0', 'new_commit' => 0, 'gerrit-opts' => $opts ); |
65
|
0
|
|
|
|
|
|
return _call_user_hook( $git, 'draft-published', \%opts ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Install hooks |
69
|
|
|
|
|
|
|
PRE_COMMIT \&pre_commit_callback; |
70
|
|
|
|
|
|
|
UPDATE \&update_callback; |
71
|
|
|
|
|
|
|
PRE_RECEIVE \&pre_receive_callback; |
72
|
|
|
|
|
|
|
REF_UPDATE \&ref_update_callback; |
73
|
|
|
|
|
|
|
PATCHSET_CREATED \&patchset_created_callback; |
74
|
|
|
|
|
|
|
DRAFT_PUBLISHED \&draft_published_callback; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |