line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Repository::Log; |
2
|
|
|
|
|
|
|
$Git::Repository::Log::VERSION = '1.312'; |
3
|
3
|
|
|
3
|
|
23974
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
98
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
65
|
|
5
|
3
|
|
|
3
|
|
52
|
use 5.006; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
223
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# a few simple accessors |
8
|
|
|
|
|
|
|
for my $attr ( |
9
|
|
|
|
|
|
|
qw( |
10
|
|
|
|
|
|
|
commit tree |
11
|
|
|
|
|
|
|
author author_name author_email |
12
|
|
|
|
|
|
|
committer committer_name committer_email |
13
|
|
|
|
|
|
|
author_localtime author_tz author_gmtime |
14
|
|
|
|
|
|
|
committer_localtime committer_tz committer_gmtime |
15
|
|
|
|
|
|
|
raw_message message subject body |
16
|
|
|
|
|
|
|
gpgsig |
17
|
|
|
|
|
|
|
extra |
18
|
|
|
|
|
|
|
) |
19
|
|
|
|
|
|
|
) |
20
|
|
|
|
|
|
|
{ |
21
|
3
|
|
|
3
|
|
14
|
no strict 'refs'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
235
|
|
22
|
191
|
|
|
191
|
|
34275
|
*$attr = sub { return $_[0]{$attr} }; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
for my $attr (qw( parent mergetag )) { |
25
|
3
|
|
|
3
|
|
13
|
no strict 'refs'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1501
|
|
26
|
48
|
100
|
|
48
|
|
1415
|
*$attr = sub { return @{ $_[0]{$attr} || [] } }; |
|
48
|
|
|
|
|
538
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
34
|
|
|
34
|
1
|
1926
|
my ( $class, @args ) = @_; |
31
|
34
|
|
|
|
|
242
|
my $self = bless { parent => [] }, $class; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# pick up key/values from the list |
34
|
34
|
|
|
|
|
213
|
while ( my ( $key, $value ) = splice @args, 0, 2 ) { |
35
|
252
|
100
|
|
|
|
1788
|
if ( $key =~ /^(?:parent|mergetag)$/ ) { |
36
|
43
|
|
|
|
|
62
|
push @{ $self->{$key} }, $value; |
|
43
|
|
|
|
|
218
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
209
|
|
|
|
|
1187
|
$self->{$key} = $value; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# special case |
44
|
34
|
|
|
|
|
180
|
$self->{commit} = (split /\s/, $self->{commit} )[0]; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# compute other keys |
47
|
34
|
|
|
|
|
143
|
$self->{raw_message} = $self->{message}; |
48
|
34
|
|
|
|
|
217
|
$self->{message} =~ s/^ //gm; |
49
|
34
|
|
|
|
|
120
|
@{$self}{qw( subject body )} |
|
34
|
|
|
|
|
156
|
|
50
|
|
|
|
|
|
|
= ( split( /\n/m, $self->{message}, 2 ), '', '' ); |
51
|
34
|
|
|
|
|
220
|
$self->{body} =~ s/\A\s//gm; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# author and committer details |
54
|
34
|
|
|
|
|
110
|
for my $who (qw( author committer )) { |
55
|
68
|
|
|
|
|
466
|
$self->{$who} =~ /^(.*) <(.*)> (.*) (([-+])(..)(..))$/; |
56
|
68
|
|
|
|
|
399
|
my @keys = ( "${who}_name", "${who}_email", "${who}_gmtime", |
57
|
|
|
|
|
|
|
"${who}_tz" ); |
58
|
68
|
|
|
|
|
137
|
@{$self}{@keys} = ( $1, $2, $3, $4 ); |
|
68
|
|
|
|
|
733
|
|
59
|
68
|
100
|
|
|
|
688
|
$self->{"${who}_localtime"} = $self->{"${who}_gmtime"} |
60
|
|
|
|
|
|
|
+ ( $5 eq '-' ? -1 : 1 ) * ( $6 * 3600 + $7 * 60 ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
34
|
|
|
|
|
1130
|
return $self; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# ABSTRACT: Class representing git log data |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Git::Repository::Log - Class representing git log data |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version 1.312 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# load the Log plugin |
85
|
|
|
|
|
|
|
use Git::Repository 'Log'; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# get the log for last commit |
88
|
|
|
|
|
|
|
my ($log) = Git::Repository->log( '-1' ); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# get the author's email |
91
|
|
|
|
|
|
|
print my $email = $log->author_email; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L<Git::Repository::Log> is a class whose instances represent |
96
|
|
|
|
|
|
|
log items from a B<git log> stream. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This method shouldn't be used directly. L<Git::Repository::Log::Iterator> |
101
|
|
|
|
|
|
|
should be the preferred way to create L<Git::Repository::Log> objects. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 new |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Create a new L<Git::Repository::Log> instance, using the list of key/values |
106
|
|
|
|
|
|
|
passed as parameters. The supported keys are (from the output of |
107
|
|
|
|
|
|
|
C<git log --pretty=raw>): |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=over 4 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item commit |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The commit id (ignoring the extra information added by I<--decorate>). |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item tree |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The tree id. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item parent |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The parent list, separated by spaces. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item author |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The author information. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item committer |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The committer information. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item message |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The log message (including the 4-space indent normally output by B<git log>). |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item gpgsig |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The commit signature. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item mergetag |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The mergetag information. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item extra |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Any extra text that might be added by extra options passed to B<git log>. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=back |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Note that since C<git tag --pretty=raw> does not provide the C<encoding> |
150
|
|
|
|
|
|
|
header (and provides the message properly decoded), this information |
151
|
|
|
|
|
|
|
will not be available via L<Git::Repository::Plugin::Log>. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 ACCESSORS |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The following accessors methods are recognized. They all return scalars, |
156
|
|
|
|
|
|
|
except for C<parent()>, which returns a list. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 Commit information |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=over 4 |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item commit |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item tree |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item parent |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=back |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 Author and committer information |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=over 4 |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item author |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item committer |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
The original author/committer line |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item author_name |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item committer_name |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item author_email |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item committer_email |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 Date information |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=over 4 |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item author_gmtime |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item committer_gmtime |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item author_localtime |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item committer_localtime |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item author_tz |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item committer_tz |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=back |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 Log information |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=over 4 |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item raw_message |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
The log message with the 4-space indent output by B<git log>. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item message |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
The unindented version of the log message. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item subject |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item body |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=back |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 Signature-related information |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=over 4 |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item gpgsig |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item mergetag |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=back |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 Extra information |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=over 4 |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item extra |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=back |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 BUGS |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
247
|
|
|
|
|
|
|
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Git-Repository-Plugin-Log or by |
248
|
|
|
|
|
|
|
email to bug-git-repository-plugin-log@rt.cpan.org. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
251
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
252
|
|
|
|
|
|
|
feature. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 AUTHOR |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Philippe Bruhat (BooK) <book@cpan.org> |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head1 COPYRIGHT |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Copyright 2010-2013 Philippe Bruhat (BooK), all rights reserved. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=head1 LICENSE |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
265
|
|
|
|
|
|
|
under the same terms as Perl itself. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |
268
|
|
|
|
|
|
|
|