lib/Git/Wrapper/Plus/Ref/Branch.pm

filter: Statementstmt 64.4% 29 / 45 Branchbran 20.0% 2 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 8 / 10 Podpod 100% 4 / 4 totaltotal 58.1% 43 / 74 SCAR 24.8
CC
7
Cov
53%
move
20.0
delete
6.0
new_from_Ref
3.9
CRAP 11.9
« blib/lib/Git/Wrapper/Plus/Support/RangeSet.pm ↑ Summary lib/Git/Wrapper/Plus/Refs.pm »
1 2 ▶use 5.008; # utf8
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Git::Wrapper::Plus::Ref::Branch;
7 2 $Git::Wrapper::Plus::Ref::Branch::VERSION = '0.004010';
8 # ABSTRACT: A Branch object
9  
10 2 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 2 ▶use Moo qw( extends );
Subroutine BEGIN: called CC=1 SCAR=0.0
40 2 extends 'Git::Wrapper::Plus::Ref';
41  
42 2 our @CARP_NOT;
43  
44  
45  
46  
47  
48  
49  
50  
51  
52 ## no critic (ProhibitMixedCaseSubs)
53 sub new_from_Ref {
54 7 ▶ my ( $class, $source_object ) = @_;
Subroutine new_from_Ref: called CC=3 SCAR=13.6
Pod documented
55 7 ▶ if ( not $source_object->can('name') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($source_object->can("name")) 0 7 7
56 0 require Carp;
57 0 return Carp::croak("Object $source_object does not respond to ->name, cannot Ref -> Branch");
58 }
59 7 my $name = $source_object->name;
60 ## no critic ( Compatibility::PerlMinimumVersionAndWhy )
61 7 ▶ if ( $name =~ qr{\Arefs/heads/(.+\z)}msx ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ qr"\Arefs/heads/(.+\z)"msx) 7 0 7
62 7 return $class->new(
63 git => $source_object->git,
64 name => $1,
65 );
66 }
67 0 require Carp;
68 0 Carp::croak("Path $name is not in refs/heads/*, cannot convert to Branch object");
69 }
70  
71  
72  
73  
74  
75  
76  
77 sub refname {
78 2 ▶ my ($self) = @_;
Subroutine refname: called CC=1 SCAR=0.0
Pod documented
79 2 return 'refs/heads/' . $self->name;
80 }
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98 ## no critic (ProhibitBuiltinHomonyms)
99  
100 sub delete {
101 0 ▶ my ( $self, $params ) = @_;
Subroutine delete: not called CC=2 SCAR=17.9
Pod documented
102 0 ▶ if ( $params->{force} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"force"}) 0 0 0
103 0 return $self->git->branch( '-D', $self->name );
104 }
105 0 return $self->git->branch( '-d', $self->name );
106  
107 }
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119 sub move {
120 0 ▶ my ( $self, $new_name, $params ) = @_;
Subroutine move: not called CC=4 SCAR=30.0
Pod documented
121 0 ▶ if ( not defined $new_name or not length $new_name ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $new_name and length $new_name) 0 0 0
Condition0%0/3
defined $new_name and length $new_name
!ll&&!rl&&r
000
MC/DC0%0/2
defined $new_name and length $new_name
defined $new_name length $new_name
Truth table0%0/3
A and B
A= defined $new_nameB= length $new_name
ABresult
0X0
100
111
122 0 require Carp;
123 ## no critic (ProhibitLocalVars)
124 0 local @CARP_NOT = __PACKAGE__;
125 0 Carp::croak(q[Move requires a defined argument to move to, with length >= 1 ]);
126 }
127 0 ▶ if ( $params->{force} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"force"}) 0 0 0
128 0 return $self->git->branch( '-M', $self->name, $new_name );
129 }
130 0 return $self->git->branch( '-m', $self->name, $new_name );
131 }
132  
133 2 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
134 2 1;
135  
136 __END__
« blib/lib/Git/Wrapper/Plus/Support/RangeSet.pm ↑ Summary lib/Git/Wrapper/Plus/Refs.pm »