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