line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Repository::Plugin::Log; |
2
|
|
|
|
|
|
|
$Git::Repository::Plugin::Log::VERSION = '1.313'; |
3
|
2
|
|
|
2
|
|
298284
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
6
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
30
|
|
5
|
2
|
|
|
2
|
|
34
|
use 5.006; |
|
2
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
791
|
use Git::Repository::Plugin; |
|
2
|
|
|
|
|
757
|
|
|
2
|
|
|
|
|
129
|
|
8
|
|
|
|
|
|
|
our @ISA = qw( Git::Repository::Plugin ); |
9
|
2
|
|
|
2
|
|
51
|
sub _keywords { qw( log ) } |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
727
|
use Git::Repository::Log::Iterator; |
|
2
|
|
|
|
|
27
|
|
|
2
|
|
|
|
|
172
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub log { |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# skip the invocant when invoked as a class method |
16
|
22
|
100
|
|
22
|
1
|
731868
|
shift if !ref $_[0]; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# get the iterator |
19
|
22
|
|
|
|
|
165
|
my $iter = Git::Repository::Log::Iterator->new(@_); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# scalar context: return the iterator |
22
|
18
|
100
|
|
|
|
302
|
return $iter if !wantarray; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# list context: return all Git::Repository::Log objects |
25
|
9
|
|
|
|
|
21
|
my @logs; |
26
|
9
|
|
|
|
|
43
|
while ( my $log = $iter->next ) { |
27
|
13
|
|
|
|
|
58
|
push @logs, $log; |
28
|
|
|
|
|
|
|
} |
29
|
7
|
|
|
|
|
106
|
return @logs; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Git::Repository::Plugin::Log - Add a log() method to Git::Repository |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# load the plugin |
45
|
|
|
|
|
|
|
use Git::Repository 'Log'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $r = Git::Repository->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# get all log objects |
50
|
|
|
|
|
|
|
my @logs = $r->log(qw( --since=yesterday )); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# get an iterator |
53
|
|
|
|
|
|
|
my $iter = $r->log(qw( --since=yesterday )); |
54
|
|
|
|
|
|
|
while ( my $log = $iter->next() ) { |
55
|
|
|
|
|
|
|
...; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This module adds a new method to L<Git::Repository>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHOD |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 log |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# iterator |
67
|
|
|
|
|
|
|
my $iter = $r->log( @args ); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# all Git::Repository::Log objects obtained from the log |
70
|
|
|
|
|
|
|
my @logs = $r->log( @args ); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Run C<git log> with the given arguments. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
In scalar context, returns a L<Git::Repository::Log::Iterator> object, |
75
|
|
|
|
|
|
|
which can return L<Git::Repository::Log> objects on demand. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
In list context, returns the full list L<Git::Repository::Log> objects. |
78
|
|
|
|
|
|
|
Note that this can be very memory-intensive. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
See L<Git::Repository::Log::Iterator>'s documentation for details about |
81
|
|
|
|
|
|
|
how parameters are handled. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Many thanks to Aristotle Pagaltzis who requested a C<log()> method in |
86
|
|
|
|
|
|
|
the first place, and for very interesting conversations on the topic. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L<Git::Repository::Plugin>, |
91
|
|
|
|
|
|
|
L<Git::Repository::Log::Iterator>, |
92
|
|
|
|
|
|
|
L<Git::Repository::Log>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Copyright 2010-2016 Philippe Bruhat (BooK), all rights reserved. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 LICENSE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
101
|
|
|
|
|
|
|
under the same terms as Perl itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |