| 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
| |||||||||||
| 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
| |||||||||||
| 33 | 0 | info "Pushing changes to $remote : $uri"; | |||||||||
| 34 | 0 | qx{ git push $remote $branch}; | |||||||||
| 35 | } | ||||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 1 | 1; | |||||||||