| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package GitStore::Revision; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
12
|
|
|
12
|
|
389
|
$GitStore::Revision::AUTHORITY = 'cpan:YANICK'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
#ABSTRACT: the state of a given path for a specific commit |
|
6
|
|
|
|
|
|
|
$GitStore::Revision::VERSION = '0.16'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
12
|
|
|
12
|
|
52
|
use strict; |
|
|
12
|
|
|
|
|
17
|
|
|
|
12
|
|
|
|
|
326
|
|
|
9
|
12
|
|
|
12
|
|
149
|
use warnings; |
|
|
12
|
|
|
|
|
15
|
|
|
|
12
|
|
|
|
|
258
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
12
|
|
|
12
|
|
50
|
use Moose; |
|
|
12
|
|
|
|
|
14
|
|
|
|
12
|
|
|
|
|
87
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
12
|
|
|
12
|
|
63356
|
use GitStore; |
|
|
12
|
|
|
|
|
22
|
|
|
|
12
|
|
|
|
|
294
|
|
|
14
|
12
|
|
|
12
|
|
54
|
use DateTime; |
|
|
12
|
|
|
|
|
16
|
|
|
|
12
|
|
|
|
|
336
|
|
|
15
|
12
|
|
|
12
|
|
52
|
use List::Util qw/ first /; |
|
|
12
|
|
|
|
|
19
|
|
|
|
12
|
|
|
|
|
722
|
|
|
16
|
12
|
|
|
12
|
|
57
|
use Path::Class; |
|
|
12
|
|
|
|
|
18
|
|
|
|
12
|
|
|
|
|
3179
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has sha1 => ( |
|
20
|
|
|
|
|
|
|
is => 'ro', |
|
21
|
|
|
|
|
|
|
required => 1, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has commit_object => ( |
|
28
|
|
|
|
|
|
|
is => 'ro', |
|
29
|
|
|
|
|
|
|
lazy => 1, |
|
30
|
|
|
|
|
|
|
default => sub { |
|
31
|
|
|
|
|
|
|
my $self = shift; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return $self->git->get_object($self->sha1); |
|
34
|
|
|
|
|
|
|
}, |
|
35
|
|
|
|
|
|
|
handles => { |
|
36
|
|
|
|
|
|
|
timestamp => 'authored_time', |
|
37
|
|
|
|
|
|
|
message => 'comment', |
|
38
|
|
|
|
|
|
|
}, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has path => ( |
|
43
|
|
|
|
|
|
|
is => 'ro', |
|
44
|
|
|
|
|
|
|
required => 1, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has gitstore => ( |
|
48
|
|
|
|
|
|
|
is => 'ro', |
|
49
|
|
|
|
|
|
|
isa => 'GitStore', |
|
50
|
|
|
|
|
|
|
required => 1, |
|
51
|
|
|
|
|
|
|
handles => { |
|
52
|
|
|
|
|
|
|
git_repo => 'git_repo', |
|
53
|
|
|
|
|
|
|
git => 'git', |
|
54
|
|
|
|
|
|
|
}, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has file_object => ( |
|
58
|
|
|
|
|
|
|
is => 'ro', |
|
59
|
|
|
|
|
|
|
lazy => 1, |
|
60
|
|
|
|
|
|
|
default => sub { |
|
61
|
|
|
|
|
|
|
my $self = shift; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$self->gitstore->_find_file( |
|
64
|
|
|
|
|
|
|
$self->commit_object->tree, file($self->path) |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
}, |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub content { |
|
72
|
6
|
|
|
6
|
1
|
2593
|
my $self = shift; |
|
73
|
|
|
|
|
|
|
|
|
74
|
6
|
|
|
|
|
188
|
$self->gitstore->deserializer->($self->gitstore,$self->path,$self->file_object->object->content); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=pod |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=encoding UTF-8 |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 NAME |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
GitStore::Revision - the state of a given path for a specific commit |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 VERSION |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
version 0.16 |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
use GitStore; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $gs = GitStore->new('/path/to/repo'); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my @history = $gs->history( 'path/to/object' ); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
for my $rev ( @history ) { |
|
104
|
|
|
|
|
|
|
say "modified at: ", $rev->timestamp; |
|
105
|
|
|
|
|
|
|
say "commit message was: ", $rev->message; |
|
106
|
|
|
|
|
|
|
say "===\n", $rev->content; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Represents an object in a L<GitStore> at a specific commit. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 METHODS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 sha1 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Returns the SHA-1 of the commit. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 commit_object |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Returns the L<Git::PurePerl::Object::Commit> object containing the file revision. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 timestamp |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Returns the commit time of the revision as a L<DateTime> object. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 message |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns the commit message of the revision. Note that the message might have |
|
130
|
|
|
|
|
|
|
additional trailing carriage returns. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 path |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Returns the path of the L<GitStore> object. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 content |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Returns the content of the object. If the object is a frozen ref, the |
|
139
|
|
|
|
|
|
|
structure will be returned, like for `GitStore`'s `get()`. |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 AUTHORS |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=over 4 |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Fayland Lam <fayland@gmail.com> |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item * |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=back |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Fayland Lam <fayland@gmail.com>. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
160
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |