lib/App/gh/Command/Push.pm

filter: Statementstmt 51.6% 16 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 50.0% 21 / 42 CC 4 SCAR 22.5
CC
4
Cov
46%
run
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.4
« lib/App/gh/Command/Drop.pm ↑ Summary lib/App/gh/API.pm »
1 package App::gh::Command::Push;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(App::gh::Command);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use App::gh::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use App::gh;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 App::gh::Command::Push - push changes to writable github remotes
11  
12 =cut
13  
14 0 ▶sub run {
Subroutine run: not called CC=4 SCAR=30.0
Pod undocumented
15 0 my $self = shift;
16  
17 0 ▶ die "Not in git repository\n" unless( -e ".git/HEAD" );
Branch: 1 branch
BranchTrueFalseTotal
unless -e ".git/HEAD" 0 0 0
18  
19 0 open FH , "<" , ".git/HEAD";
20 0 my $ref = <FH>;
21 0 close FH;
22 0 chomp( $ref );
23  
24 0 my ($branch) = ( $ref =~ m{ref:\s(\S+)} );
25  
26 0 my @lines = split /\n/,qx{ git remote -v | grep '(fetch)'};
27 0 for my $line ( @lines ) {
28 0 my ( $remote , $uri , $type ) = ($line =~ m{^(\w+)\s+(\S+)\s+\((\w+)\)} );
29 0 info "Updating from $remote ...";
30 0 qx{ git pull --rebase $remote $branch};
31  
32 0 ▶ if( $uri =~ /^git\@github\.com/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uri =~ /^git\@github\.com/) 0 0 0
33 0 info "Pushing changes to $remote : $uri";
34 0 qx{ git push $remote $branch};
35 }
36 }
37 }
38  
39 1 1;
« lib/App/gh/Command/Drop.pm ↑ Summary lib/App/gh/API.pm »