line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1039
|
use 5.006; # our |
|
3
|
|
|
|
|
10
|
|
2
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
76
|
|
3
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
218
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Git::Wrapper::Plus::Tags; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.004011'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Extract all tags from a repository |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
3
|
|
477
|
use Moo qw( has ); |
|
3
|
|
|
|
|
10710
|
|
|
3
|
|
|
|
|
17
|
|
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
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has 'git' => ( is => ro =>, required => 1 ); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has 'refs' => ( is => ro =>, lazy => 1, builder => 1 ); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _build_refs { |
77
|
1
|
|
|
1
|
|
9
|
my ($self) = @_; |
78
|
1
|
|
|
|
|
541
|
require Git::Wrapper::Plus::Refs; |
79
|
1
|
|
|
|
|
5
|
return Git::Wrapper::Plus::Refs->new( git => $self->git ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _to_tag { |
83
|
10
|
|
|
10
|
|
35
|
my ( undef, $ref ) = @_; |
84
|
10
|
|
|
|
|
503
|
require Git::Wrapper::Plus::Ref::Tag; |
85
|
10
|
|
|
|
|
50
|
return Git::Wrapper::Plus::Ref::Tag->new_from_Ref($ref); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _to_tags { |
89
|
5
|
|
|
5
|
|
19
|
my ( $self, @refs ) = @_; |
90
|
5
|
|
|
|
|
10
|
return map { $self->_to_tag($_) } @refs; |
|
10
|
|
|
|
|
1621
|
|
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# There's 2 types of results that come back from git ls-remote |
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
# tags, and heavy tags ( usually annotations ) |
96
|
|
|
|
|
|
|
# |
97
|
|
|
|
|
|
|
# puretags look like |
98
|
|
|
|
|
|
|
# |
99
|
|
|
|
|
|
|
# abffab foo # pointer to the commit |
100
|
|
|
|
|
|
|
# |
101
|
|
|
|
|
|
|
# While heavy tags come in pairs |
102
|
|
|
|
|
|
|
# |
103
|
|
|
|
|
|
|
# fabfab foo # heavy tag pointer |
104
|
|
|
|
|
|
|
# abffab foo^{} # pointer to the actual commit |
105
|
|
|
|
|
|
|
# |
106
|
|
|
|
|
|
|
# However, we don't really care about the second half of the latter kind. |
107
|
|
|
|
|
|
|
# |
108
|
|
|
|
|
|
|
sub _grep_commit_pointers { |
109
|
5
|
|
|
5
|
|
22
|
my ( undef, @refs ) = @_; |
110
|
5
|
|
|
|
|
6
|
my (@out); |
111
|
5
|
|
|
|
|
14
|
for my $ref (@refs) { |
112
|
10
|
50
|
|
|
|
75
|
next if $ref->name =~ /[^][{][}]\z/msx; |
113
|
10
|
|
|
|
|
13
|
push @out, $ref; |
114
|
|
|
|
|
|
|
} |
115
|
5
|
|
|
|
|
26
|
return @out; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub tags { |
129
|
5
|
|
|
5
|
1
|
33163
|
my ($self) = @_; |
130
|
5
|
|
|
|
|
28
|
return $self->get_tag(q[**]); |
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
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub get_tag { |
158
|
5
|
|
|
5
|
1
|
16
|
my ( $self, $name ) = @_; |
159
|
5
|
|
|
|
|
225
|
return $self->_to_tags( $self->_grep_commit_pointers( $self->refs->get_ref( 'refs/tags/' . $name ) ) ); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub tag_sha1_map { |
175
|
3
|
|
|
3
|
1
|
645
|
my ($self) = @_; |
176
|
|
|
|
|
|
|
|
177
|
3
|
|
|
|
|
7
|
my %hash; |
178
|
3
|
|
|
|
|
21
|
for my $tag ( $self->tags ) { |
179
|
6
|
|
|
|
|
88
|
my $sha_one = $tag->sha1; |
180
|
6
|
100
|
|
|
|
33
|
if ( not exists $hash{$sha_one} ) { |
181
|
3
|
|
|
|
|
12
|
$hash{$sha_one} = []; |
182
|
|
|
|
|
|
|
} |
183
|
6
|
|
|
|
|
7
|
push @{ $hash{$sha_one} }, $tag; |
|
6
|
|
|
|
|
84
|
|
184
|
|
|
|
|
|
|
} |
185
|
3
|
|
|
|
|
45
|
return \%hash; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub tags_for_rev { |
201
|
2
|
|
|
2
|
1
|
5
|
my ( $self, $rev ) = @_; |
202
|
2
|
|
|
|
|
22
|
my (@shas) = $self->git->rev_parse($rev); |
203
|
2
|
50
|
|
|
|
7863
|
if ( scalar @shas != 1 ) { |
204
|
0
|
|
|
|
|
0
|
require Carp; |
205
|
0
|
|
|
|
|
0
|
Carp::croak("Could not resolve a SHA1 from rev $rev"); |
206
|
|
|
|
|
|
|
} |
207
|
2
|
|
|
|
|
10
|
my ($sha) = shift @shas; |
208
|
2
|
|
|
|
|
21
|
my $map = $self->tag_sha1_map; |
209
|
2
|
50
|
|
|
|
21
|
return unless exists $map->{$sha}; |
210
|
2
|
|
|
|
|
3
|
return @{ $map->{$sha} }; |
|
2
|
|
|
|
|
33
|
|
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
3
|
|
|
3
|
|
3100
|
no Moo; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
15
|
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
1; |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
__END__ |