line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
927
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Ukigumo::Client::VC::Git; |
6
|
1
|
|
|
1
|
|
27
|
use Mouse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
287
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
479
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Ukigumo::Client::Role::VC'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has log_limit => ( is => 'ro', isa => 'Int', default => 50 ); |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
|
sub default_branch { 'master' } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_revision { |
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
17
|
0
|
|
0
|
|
|
|
$self->{revision} ||= `git rev-parse HEAD` || 'Unknown'; |
|
|
|
0
|
|
|
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub update { |
21
|
0
|
|
|
0
|
0
|
|
my ($self, $c) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$c->logger->infof("workdir is " . Cwd::getcwd()); |
24
|
0
|
0
|
|
|
|
|
unless (-d ".git") { |
25
|
0
|
0
|
|
|
|
|
$c->tee("git clone --branch $self->{branch} @{[ $self->repository ]} ./") == 0 or die "Cannot clone repository"; |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
27
|
0
|
0
|
|
|
|
|
$c->tee("git pull -f origin $self->{branch}")==0 or die "git fail"; |
28
|
0
|
0
|
|
|
|
|
$c->tee("git submodule init")==0 or die "git fail"; |
29
|
0
|
0
|
|
|
|
|
$c->tee("git submodule update")==0 or die "git fail"; |
30
|
0
|
0
|
|
|
|
|
$c->tee("git clean -dxf")==0 or die "git fail"; |
31
|
0
|
0
|
|
|
|
|
$c->tee("git status")==0 or die "git fail"; |
32
|
0
|
|
|
|
|
|
delete $self->{revision}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_log { |
36
|
0
|
|
|
0
|
0
|
|
my ($self, $rev1, $rev2) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $git_log_cmd = 'git log --pretty=format:"%h %an: %s" --abbrev-commit --source '; |
39
|
0
|
0
|
|
|
|
|
if ($rev1 eq $rev2) { |
40
|
0
|
|
|
|
|
|
$git_log_cmd .= "-1 'HEAD'"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
else { |
43
|
0
|
|
|
|
|
|
$git_log_cmd .= "-@{[ $self->log_limit ]} '$rev1..$rev2'"; |
|
0
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
`$git_log_cmd`; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |