line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
2104
|
use 5.008; # utf8 |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
122
|
|
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
105
|
|
3
|
3
|
|
|
3
|
|
26
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
88
|
|
4
|
3
|
|
|
3
|
|
986
|
use utf8; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
20
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Git::Wrapper::Plus::Branches; |
7
|
|
|
|
|
|
|
$Git::Wrapper::Plus::Branches::VERSION = '0.004010'; |
8
|
|
|
|
|
|
|
# ABSTRACT: Extract branches from Git |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
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
|
3
|
|
|
3
|
|
3156
|
use Moo qw( has ); |
|
3
|
|
|
|
|
22088
|
|
|
3
|
|
|
|
|
19
|
|
55
|
3
|
|
|
3
|
|
4647
|
use Git::Wrapper::Plus::Util qw(exit_status_handler); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
25
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has 'git' => ( is => ro =>, required => 1 ); |
68
|
|
|
|
|
|
|
has 'refs' => ( is => ro =>, lazy => 1, builder => 1 ); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub _build_refs { |
71
|
1
|
|
|
1
|
|
1270
|
my ($self) = @_; |
72
|
1
|
|
|
|
|
1923
|
require Git::Wrapper::Plus::Refs; |
73
|
1
|
|
|
|
|
13
|
return Git::Wrapper::Plus::Refs->new( git => $self->git ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _to_branch { |
77
|
7
|
|
|
7
|
|
21
|
my ( undef, $ref ) = @_; |
78
|
7
|
|
|
|
|
2105
|
require Git::Wrapper::Plus::Ref::Branch; |
79
|
7
|
|
|
|
|
47
|
return Git::Wrapper::Plus::Ref::Branch->new_from_Ref($ref); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub _to_branches { |
83
|
3
|
|
|
3
|
|
17
|
my ( $self, @refs ) = @_; |
84
|
3
|
|
|
|
|
9
|
return map { $self->_to_branch($_) } @refs; |
|
7
|
|
|
|
|
144
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub branches { |
98
|
2
|
|
|
2
|
1
|
1186
|
my ( $self, ) = @_; |
99
|
2
|
|
|
|
|
16
|
return $self->get_branch(q[**]); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub get_branch { |
123
|
3
|
|
|
3
|
1
|
10
|
my ( $self, $name ) = @_; |
124
|
3
|
|
|
|
|
96
|
return $self->_to_branches( $self->refs->get_ref( 'refs/heads/' . $name ) ); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub _current_branch_name { |
128
|
2
|
|
|
2
|
|
5
|
my ($self) = @_; |
129
|
2
|
|
|
|
|
12
|
my (@current_names); |
130
|
|
|
|
|
|
|
return unless exit_status_handler( |
131
|
|
|
|
|
|
|
sub { |
132
|
2
|
|
|
2
|
|
46
|
(@current_names) = $self->git->symbolic_ref('HEAD'); |
133
|
|
|
|
|
|
|
}, |
134
|
|
|
|
|
|
|
{ |
135
|
1
|
|
|
1
|
|
5
|
128 => sub { return }, |
136
|
|
|
|
|
|
|
}, |
137
|
2
|
100
|
|
|
|
65
|
); |
138
|
1
|
|
|
|
|
33
|
for (@current_names) { |
139
|
1
|
|
|
|
|
25
|
$_ =~ s{\A refs/heads/ }{}msx; |
140
|
|
|
|
|
|
|
} |
141
|
1
|
|
|
|
|
11
|
return @current_names; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub current_branch { |
159
|
2
|
|
|
2
|
1
|
156458
|
my ( $self, ) = @_; |
160
|
2
|
|
|
|
|
32
|
my ($ref) = $self->_current_branch_name; |
161
|
2
|
100
|
|
|
|
63
|
return if not $ref; |
162
|
1
|
|
|
|
|
20
|
my (@items) = $self->get_branch($ref); |
163
|
1
|
50
|
|
|
|
2819
|
return shift @items if 1 == @items; |
164
|
0
|
|
|
|
|
|
require Carp; |
165
|
0
|
|
|
|
|
|
Carp::confess( 'get_branch(' . $ref . ') returned multiple values. Cannot determine current branch' ); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
3
|
|
|
3
|
|
2135
|
no Moo; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
28
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
1; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
__END__ |