line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
2981
|
use 5.008; # utf8 |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
142
|
|
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
125
|
|
3
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
104
|
|
4
|
3
|
|
|
3
|
|
1371
|
use utf8; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Git::Wrapper::Plus::Tags; |
7
|
|
|
|
|
|
|
$Git::Wrapper::Plus::Tags::VERSION = '0.004010'; |
8
|
|
|
|
|
|
|
# ABSTRACT: Extract all tags from a repository |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
1357
|
use Moo qw( has ); |
|
3
|
|
|
|
|
26050
|
|
|
3
|
|
|
|
|
23
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has 'git' => ( is => ro =>, required => 1 ); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has 'refs' => ( is => ro =>, lazy => 1, builder => 1 ); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _build_refs { |
76
|
1
|
|
|
1
|
|
533
|
my ($self) = @_; |
77
|
1
|
|
|
|
|
1386
|
require Git::Wrapper::Plus::Refs; |
78
|
1
|
|
|
|
|
8
|
return Git::Wrapper::Plus::Refs->new( git => $self->git ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _to_tag { |
82
|
10
|
|
|
10
|
|
24
|
my ( undef, $ref ) = @_; |
83
|
10
|
|
|
|
|
1192
|
require Git::Wrapper::Plus::Ref::Tag; |
84
|
10
|
|
|
|
|
84
|
return Git::Wrapper::Plus::Ref::Tag->new_from_Ref($ref); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _to_tags { |
88
|
5
|
|
|
5
|
|
32
|
my ( $self, @refs ) = @_; |
89
|
5
|
|
|
|
|
14
|
return map { $self->_to_tag($_) } @refs; |
|
10
|
|
|
|
|
1826
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# There's 2 types of results that come back from git ls-remote |
93
|
|
|
|
|
|
|
# |
94
|
|
|
|
|
|
|
# tags, and heavy tags ( usually annotations ) |
95
|
|
|
|
|
|
|
# |
96
|
|
|
|
|
|
|
# puretags look like |
97
|
|
|
|
|
|
|
# |
98
|
|
|
|
|
|
|
# abffab foo # pointer to the commit |
99
|
|
|
|
|
|
|
# |
100
|
|
|
|
|
|
|
# While heavy tags come in pairs |
101
|
|
|
|
|
|
|
# |
102
|
|
|
|
|
|
|
# fabfab foo # heavy tag pointer |
103
|
|
|
|
|
|
|
# abffab foo^{} # pointer to the actual commit |
104
|
|
|
|
|
|
|
# |
105
|
|
|
|
|
|
|
# However, we don't really care about the second half of the latter kind. |
106
|
|
|
|
|
|
|
# |
107
|
|
|
|
|
|
|
sub _grep_commit_pointers { |
108
|
5
|
|
|
5
|
|
36
|
my ( undef, @refs ) = @_; |
109
|
5
|
|
|
|
|
9
|
my (@out); |
110
|
5
|
|
|
|
|
27
|
for my $ref (@refs) { |
111
|
10
|
50
|
|
|
|
75
|
next if $ref->name =~ /[^][{][}]\z/msx; |
112
|
10
|
|
|
|
|
95
|
push @out, $ref; |
113
|
|
|
|
|
|
|
} |
114
|
5
|
|
|
|
|
39
|
return @out; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub tags { |
128
|
5
|
|
|
5
|
1
|
139284
|
my ($self) = @_; |
129
|
5
|
|
|
|
|
65
|
return $self->get_tag(q[**]); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub get_tag { |
157
|
5
|
|
|
5
|
1
|
27
|
my ( $self, $name ) = @_; |
158
|
5
|
|
|
|
|
267
|
return $self->_to_tags( $self->_grep_commit_pointers( $self->refs->get_ref( 'refs/tags/' . $name ) ) ); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub tag_sha1_map { |
174
|
3
|
|
|
3
|
1
|
958
|
my ($self) = @_; |
175
|
|
|
|
|
|
|
|
176
|
3
|
|
|
|
|
9
|
my %hash; |
177
|
3
|
|
|
|
|
31
|
for my $tag ( $self->tags ) { |
178
|
6
|
|
|
|
|
352
|
my $sha_one = $tag->sha1; |
179
|
6
|
100
|
|
|
|
81
|
if ( not exists $hash{$sha_one} ) { |
180
|
3
|
|
|
|
|
26
|
$hash{$sha_one} = []; |
181
|
|
|
|
|
|
|
} |
182
|
6
|
|
|
|
|
15
|
push @{ $hash{$sha_one} }, $tag; |
|
6
|
|
|
|
|
198
|
|
183
|
|
|
|
|
|
|
} |
184
|
3
|
|
|
|
|
130
|
return \%hash; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub tags_for_rev { |
200
|
2
|
|
|
2
|
1
|
8
|
my ( $self, $rev ) = @_; |
201
|
2
|
|
|
|
|
41
|
my (@shas) = $self->git->rev_parse($rev); |
202
|
2
|
50
|
|
|
|
38894
|
if ( scalar @shas != 1 ) { |
203
|
0
|
|
|
|
|
0
|
require Carp; |
204
|
0
|
|
|
|
|
0
|
Carp::croak("Could not resolve a SHA1 from rev $rev"); |
205
|
|
|
|
|
|
|
} |
206
|
2
|
|
|
|
|
24
|
my ($sha) = shift @shas; |
207
|
2
|
|
|
|
|
23
|
my $map = $self->tag_sha1_map; |
208
|
2
|
50
|
|
|
|
16
|
return unless exists $map->{$sha}; |
209
|
2
|
|
|
|
|
6
|
return @{ $map->{$sha} }; |
|
2
|
|
|
|
|
50
|
|
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
3
|
|
|
3
|
|
6209
|
no Moo; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
20
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
1; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
__END__ |