line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::GitGot::Repo; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENEHACK'; |
3
|
|
|
|
|
|
|
$App::GitGot::Repo::VERSION = '1.336'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Base repository objects |
5
|
16
|
|
|
16
|
|
114923
|
use 5.014; |
|
16
|
|
|
|
|
50
|
|
6
|
|
|
|
|
|
|
|
7
|
16
|
|
|
16
|
|
73
|
use List::Util qw/ uniq /; |
|
16
|
|
|
|
|
22
|
|
|
16
|
|
|
|
|
786
|
|
8
|
16
|
|
|
16
|
|
539
|
use Types::Standard -types; |
|
16
|
|
|
|
|
57035
|
|
|
16
|
|
|
|
|
391
|
|
9
|
|
|
|
|
|
|
|
10
|
16
|
|
|
16
|
|
57896
|
use App::GitGot::Types; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
77
|
|
11
|
|
|
|
|
|
|
|
12
|
16
|
|
|
16
|
|
2861
|
use Moo; |
|
16
|
|
|
|
|
7418
|
|
|
16
|
|
|
|
|
1062
|
|
13
|
16
|
|
|
16
|
|
8082
|
use namespace::autoclean; |
|
16
|
|
|
|
|
9206
|
|
|
16
|
|
|
|
|
67
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has label => ( |
17
|
|
|
|
|
|
|
is => 'ro' , |
18
|
|
|
|
|
|
|
isa => Str , |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has name => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => Str, |
25
|
|
|
|
|
|
|
required => 1 , |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has number => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => Int, |
32
|
|
|
|
|
|
|
required => 1 , |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has path => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => Str, |
39
|
|
|
|
|
|
|
required => 1 , |
40
|
|
|
|
|
|
|
coerce => sub { ref $_[0] && $_[0]->isa('Path::Tiny') ? "$_[0]" : $_[0] } , |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has repo => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Str, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has tags => ( |
51
|
|
|
|
|
|
|
is => 'rw', |
52
|
|
|
|
|
|
|
isa => Str, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has type => ( |
57
|
|
|
|
|
|
|
is => 'ro', |
58
|
|
|
|
|
|
|
isa => Str, |
59
|
|
|
|
|
|
|
required => 1 , |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub BUILDARGS { |
63
|
101
|
|
|
101
|
0
|
145412
|
my( $class , $args ) = @_; |
64
|
|
|
|
|
|
|
|
65
|
101
|
|
100
|
|
|
366
|
my $count = $args->{count} || 0; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
die "Must provide entry" unless |
68
|
101
|
100
|
|
|
|
291
|
my $entry = $args->{entry}; |
69
|
|
|
|
|
|
|
|
70
|
99
|
|
100
|
|
|
358
|
my $repo = $entry->{repo} //= ''; |
71
|
|
|
|
|
|
|
|
72
|
99
|
100
|
|
|
|
223
|
if ( ! defined $entry->{name} ) { |
73
|
|
|
|
|
|
|
### FIXME this is unnecessarily Git-specific |
74
|
2
|
50
|
|
|
|
24
|
$entry->{name} = ( $repo =~ m|([^/]+).git$| ) ? $1 : ''; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
99
|
|
100
|
|
|
391
|
$entry->{tags} //= ''; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $return = { |
80
|
|
|
|
|
|
|
number => $count , |
81
|
|
|
|
|
|
|
name => $entry->{name} , |
82
|
|
|
|
|
|
|
path => $entry->{path} , |
83
|
|
|
|
|
|
|
repo => $repo , |
84
|
|
|
|
|
|
|
type => $entry->{type} , |
85
|
|
|
|
|
|
|
tags => $entry->{tags} , |
86
|
99
|
|
|
|
|
453
|
}; |
87
|
|
|
|
|
|
|
|
88
|
99
|
100
|
|
|
|
276
|
$return->{label} = $args->{label} if $args->{label}; |
89
|
|
|
|
|
|
|
|
90
|
99
|
|
|
|
|
1595
|
return $return; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub add_tags { |
95
|
1
|
|
|
1
|
1
|
39
|
my( $self, @tags ) = @_; |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
19
|
$self->tags( join ' ', uniq sort @tags, split ' ', $self->tags ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub in_writable_format { |
102
|
23
|
|
|
23
|
1
|
5203
|
my $self = shift; |
103
|
|
|
|
|
|
|
|
104
|
23
|
|
|
|
|
251
|
my $writeable = { |
105
|
|
|
|
|
|
|
name => $self->name , |
106
|
|
|
|
|
|
|
path => $self->path , |
107
|
|
|
|
|
|
|
}; |
108
|
|
|
|
|
|
|
|
109
|
23
|
|
|
|
|
66
|
foreach ( qw/ repo tags type /) { |
110
|
69
|
100
|
|
|
|
1009
|
$writeable->{$_} = $self->$_ if $self->$_; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
23
|
|
|
|
|
234
|
return $writeable; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub remove_tags { |
118
|
1
|
|
|
1
|
1
|
33
|
my( $self, @tags ) = @_; |
119
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
4
|
my %verboten = map { $_ => 1 } @tags; |
|
1
|
|
|
|
|
4
|
|
121
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
18
|
$self->tags( join ' ', grep { !$verboten{$_} } split ' ', $self->tags ); |
|
2
|
|
|
|
|
23
|
|
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |