line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Repository::Plugin::Gerrit; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4255
|
use 5.008005; |
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
41
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
83
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.05"; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
702
|
use parent qw(Git::Repository::Plugin); |
|
1
|
|
|
|
|
398
|
|
|
1
|
|
|
|
|
6
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
2068
|
use Git::Repository qw(Log); |
|
1
|
|
|
|
|
32810
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
|
0
|
sub _keywords { qw( |
14
|
|
|
|
|
|
|
find_change |
15
|
|
|
|
|
|
|
) } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
18
|
1
|
|
|
1
|
|
16
|
require Git::Repository::Log; |
19
|
1
|
|
|
|
|
1
|
my $attr = 'Git::Repository::Log::change_id'; |
20
|
1
|
|
|
1
|
|
5008
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
335
|
|
21
|
|
|
|
|
|
|
*$attr = sub { |
22
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
23
|
0
|
|
|
|
|
0
|
return ($self->{message} =~ /Change-Id: (I\S{40})/)[0]; |
24
|
1
|
|
|
|
|
24
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub find_change { |
28
|
0
|
|
|
0
|
1
|
0
|
my $repo = shift; |
29
|
0
|
|
|
|
|
0
|
my $change_id = __PACKAGE__->_normalize_change_id(shift); |
30
|
0
|
|
|
|
|
0
|
my @extra = @_; |
31
|
0
|
|
|
|
|
0
|
my $pattern = "Change-Id: ${change_id}"; |
32
|
0
|
|
|
|
|
0
|
my @logs = $repo->log("--grep=$pattern", @extra); |
33
|
0
|
0
|
|
|
|
0
|
if (@logs > 1) { |
34
|
0
|
|
|
|
|
0
|
die 'Non-unique Change-Id!'; |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
0
|
return shift @logs; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _normalize_change_id { |
40
|
4
|
|
|
4
|
|
2633
|
my $package = shift; |
41
|
4
|
|
|
|
|
5
|
my $change_id = shift; |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
5
|
my $orig_change_id = $change_id; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
10
|
$change_id =~ s/^Change-Id: //; |
46
|
|
|
|
|
|
|
|
47
|
4
|
100
|
|
|
|
12
|
if (length($change_id) == 40) { |
48
|
1
|
|
|
|
|
3
|
$change_id = 'I' . $change_id; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
4
|
100
|
|
|
|
12
|
unless (length($change_id) == 41) { |
52
|
1
|
|
|
|
|
13
|
die "Unable to normalize Change-Id '$orig_change_id'"; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
19
|
return $change_id; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
__END__ |