GitGot/Command/push.pm

filter: Statementstmt 83.3% 30 / 36 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 75.4% 43 / 57 CC 6 SCAR 15.0
CC
6
Cov
78%
_execute
9.4
__ANON__
2.0
__ANON__
2.0
CRAP 4.5
« GitGot/Command/remove.pm ↑ Summary GitGot/Repo.pm »
1 package App::GitGot::Command::push;
2 16 our $AUTHORITY = 'cpan:GENEHACK';
3 16 $App::GitGot::Command::push::VERSION = '1.339';
4 # ABSTRACT: Push local changes to the default remote in git repos
5 16 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 16 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 ▶use App::GitGot -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 16 extends 'App::GitGot::Command';
14 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 # incremental output looks nicer for this command...
17 16 STDOUT->autoflush(1);
18 2 ▶sub _use_io_page { 0 }
Subroutine _use_io_page: called CC=1 SCAR=0.0
19  
20 2 ▶sub _execute {
Subroutine _execute: called CC=6 SCAR=22.4
21 2 my( $self, $opt, $args ) = @_;
22  
23 2 my $max_len = $self->max_length_of_an_active_repo_label;
24  
25 2 REPO: for my $repo ( $self->active_repos ) {
26 8 ▶ next REPO unless $repo->type eq 'git';
Branch: 1 branch
BranchTrueFalseTotal
unless $repo->type eq "git" 0 8 8
27  
28 8 ▶ unless ( $repo->current_remote_branch and $repo->cherry ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($repo->current_remote_branch and $repo->cherry) 8 0 8
Condition33%1/3
$repo->current_remote_branch and $repo->cherry
!ll&&!rl&&r
800
MC/DC0%0/2
$repo->current_remote_branch and $repo->cherry
$repo->current_remote_branch $repo->cherry
Truth table33%1/3
A and B
A= $repo->current_remote_branchB= $repo->cherry
ABresult
0X0
100
111
29 8 ▶ printf "%3d) %-${max_len}s : Nothing to push\n",
Branch: 1 branch
BranchTrueFalseTotal
unless $self->quiet 4 4 8
30 $repo->number , $repo->label unless $self->quiet;
31 8 next REPO;
32 }
33  
34 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
35 0 printf "%3d) %-${max_len}s : ", $repo->number , $repo->label;
36 # really wish this gave _some_ kind of output...
37 0 my @output = $repo->push;
38 0 printf "%s\n", $self->major_change( 'PUSHED' );
39 }
40 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 0 say STDERR $self->error( 'ERROR: Problem with push on repo ' , $repo->label );
42 0 say STDERR "\n" , Dumper $_;
43 0 };
44 }
45 }
46  
47 16 1;
48  
49 ## FIXME docs
50  
51 __END__
« GitGot/Command/remove.pm ↑ Summary GitGot/Repo.pm »