line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Repository::FileHistory; |
2
|
1
|
|
|
1
|
|
23461
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
25
|
use 5.008001; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
58
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
451
|
use Git::Repository::Log::Iterator; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
|
|
|
|
|
|
my ($class, $repo, @files) = @_; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $args; |
13
|
|
|
|
|
|
|
$args = pop @files if ref $files[-1] eq 'HASH'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my @cmd = ('--', @files); |
16
|
|
|
|
|
|
|
unshift @cmd, $args->{branch} if $args->{branch}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $iter = Git::Repository::Log::Iterator->new($repo, @cmd); |
19
|
|
|
|
|
|
|
my @logs; |
20
|
|
|
|
|
|
|
while ( my $log = $iter->next ){ |
21
|
|
|
|
|
|
|
push @logs, $log; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
bless { |
25
|
|
|
|
|
|
|
file_name => @files == 1 ? $files[0] : \@files, |
26
|
|
|
|
|
|
|
logs => \@logs, |
27
|
|
|
|
|
|
|
}, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub file_name { shift->{file_name} } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub logs { |
33
|
|
|
|
|
|
|
my $logs = shift->{logs}; |
34
|
|
|
|
|
|
|
wantarray ? @$logs : $logs; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub last_log { shift->logs->[0] } |
38
|
|
|
|
|
|
|
sub first_log { shift->logs->[-1] } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub created_at { |
41
|
|
|
|
|
|
|
my $first = shift->first_log; |
42
|
|
|
|
|
|
|
$first && $first->author_gmtime; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub last_modified_at { |
46
|
|
|
|
|
|
|
my $last = shift->last_log; |
47
|
|
|
|
|
|
|
$last && $last->author_gmtime; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
{ |
50
|
|
|
|
|
|
|
no warnings 'once'; |
51
|
|
|
|
|
|
|
*updated_at = *last_modified_at; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub created_by { |
55
|
|
|
|
|
|
|
my $first = shift->first_log; |
56
|
|
|
|
|
|
|
$first && $first->author_name; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub last_modified_by { |
60
|
|
|
|
|
|
|
my $last = shift->last_log; |
61
|
|
|
|
|
|
|
$last && $last->author_name; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
__END__ |