| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::gh::Command::Push; |
|
2
|
1
|
|
|
1
|
|
2310
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
129
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use base qw(App::gh::Command); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
90
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use App::gh::Utils; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
86
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use App::gh; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
878
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
App::gh::Command::Push - push changes to writable github remotes |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub run { |
|
15
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
die "Not in git repository\n" unless( -e ".git/HEAD" ); |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
open FH , "<" , ".git/HEAD"; |
|
20
|
0
|
|
|
|
|
|
my $ref = ; |
|
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
|
0
|
|
|
|
|
if( $uri =~ /^git\@github\.com/ ) { |
|
33
|
0
|
|
|
|
|
|
info "Pushing changes to $remote : $uri"; |
|
34
|
0
|
|
|
|
|
|
qx{ git push $remote $branch}; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |