line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1837588
|
use 5.006; # our |
|
2
|
|
|
|
|
7
|
|
2
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
46
|
|
3
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
184
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Git::PurePerl::Walker; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.004001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Walk over a sequence of commits in a Git::PurePerl repo |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
449
|
use Moose qw( has ); |
|
2
|
|
|
|
|
292757
|
|
|
2
|
|
|
|
|
18
|
|
14
|
2
|
|
|
2
|
|
9305
|
use Path::Tiny qw(); |
|
2
|
|
|
|
|
7869
|
|
|
2
|
|
|
|
|
39
|
|
15
|
2
|
|
|
2
|
|
10
|
use Module::Runtime qw( ); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
35
|
|
16
|
2
|
|
|
2
|
|
753
|
use Git::PurePerl::Walker::Types qw( GPPW_Repository GPPW_Methodish GPPW_Method GPPW_OnCommitish GPPW_OnCommit); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
17
|
2
|
|
|
2
|
|
6629
|
use namespace::autoclean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has repo => ( |
34
|
|
|
|
|
|
|
isa => GPPW_Repository, |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
lazy_build => 1, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
has _method => ( |
80
|
|
|
|
|
|
|
init_arg => 'method', |
81
|
|
|
|
|
|
|
is => 'ro', |
82
|
|
|
|
|
|
|
isa => GPPW_Methodish, |
83
|
|
|
|
|
|
|
required => 1, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
has 'method' => ( |
96
|
|
|
|
|
|
|
init_arg => undef, |
97
|
|
|
|
|
|
|
is => 'ro', |
98
|
|
|
|
|
|
|
isa => GPPW_Method, |
99
|
|
|
|
|
|
|
lazy_build => 1, |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
has '_on_commit' => ( |
155
|
|
|
|
|
|
|
init_arg => 'on_commit', |
156
|
|
|
|
|
|
|
required => 1, |
157
|
|
|
|
|
|
|
is => 'ro', |
158
|
|
|
|
|
|
|
isa => GPPW_OnCommitish, |
159
|
|
|
|
|
|
|
); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
has 'on_commit' => ( |
171
|
|
|
|
|
|
|
init_arg => undef, |
172
|
|
|
|
|
|
|
isa => GPPW_OnCommit, |
173
|
|
|
|
|
|
|
is => 'ro', |
174
|
|
|
|
|
|
|
lazy_build => 1, |
175
|
|
|
|
|
|
|
); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub BUILD { |
186
|
1
|
|
|
1
|
0
|
2
|
my ( $self, ) = @_; |
187
|
1
|
|
|
|
|
4
|
$self->reset; |
188
|
1
|
|
|
|
|
28
|
return $self; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub _build_repo { |
196
|
0
|
|
|
0
|
|
0
|
require Git::PurePerl; |
197
|
0
|
|
|
|
|
0
|
return Git::PurePerl->new( directory => Path::Tiny->cwd->stringify ); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub _build_method { |
205
|
1
|
|
|
1
|
|
2
|
my ($self) = shift; |
206
|
1
|
|
|
|
|
25
|
my ($method) = $self->_method; |
207
|
|
|
|
|
|
|
|
208
|
1
|
50
|
|
|
|
3
|
if ( not ref $method ) { |
209
|
0
|
|
|
|
|
0
|
my $method_name = Module::Runtime::compose_module_name( 'Git::PurePerl::Walker::Method', $method ); |
210
|
0
|
|
|
|
|
0
|
Module::Runtime::require_module($method_name); |
211
|
0
|
|
|
|
|
0
|
$method = $method_name->new(); |
212
|
|
|
|
|
|
|
} |
213
|
1
|
|
|
|
|
25
|
return $method->for_repository( $self->repo ); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
sub _build_on_commit { |
221
|
1
|
|
|
1
|
|
7
|
my ($self) = shift; |
222
|
1
|
|
|
|
|
50
|
my ($on_commit) = $self->_on_commit; |
223
|
|
|
|
|
|
|
|
224
|
1
|
50
|
33
|
|
|
19
|
if ( ref $on_commit and 'CODE' eq ref $on_commit ) { |
|
|
0
|
|
|
|
|
|
225
|
1
|
|
|
|
|
5
|
my $on_commit_name = 'Git::PurePerl::Walker::OnCommit::CallBack'; |
226
|
1
|
|
|
|
|
3
|
my $callback = $on_commit; |
227
|
1
|
|
|
|
|
10
|
Module::Runtime::require_module($on_commit_name); |
228
|
1
|
|
|
|
|
37
|
$on_commit = $on_commit_name->new( callback => $callback, ); |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
elsif ( not ref $on_commit ) { |
231
|
0
|
|
|
|
|
0
|
my $on_commit_name = 'Git::PurePerl::Walker::OnCommit::' . $on_commit; |
232
|
0
|
|
|
|
|
0
|
Module::Runtime::require_module($on_commit_name); |
233
|
0
|
|
|
|
|
0
|
$on_commit = $on_commit_name->new(); |
234
|
|
|
|
|
|
|
} |
235
|
1
|
|
|
|
|
30
|
return $on_commit->for_repository( $self->repo ); |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitBuiltinHomonyms) |
247
|
|
|
|
|
|
|
sub reset { |
248
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
249
|
1
|
|
|
|
|
27
|
$self->method->reset; |
250
|
1
|
|
|
|
|
55
|
$self->on_commit->reset; |
251
|
1
|
|
|
|
|
4
|
return $self; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub step { |
282
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
283
|
|
|
|
|
|
|
|
284
|
2
|
|
|
|
|
50
|
$self->on_commit->handle( $self->method->current ); |
285
|
|
|
|
|
|
|
|
286
|
2
|
100
|
|
|
|
45
|
if ( not $self->method->has_next ) { |
287
|
1
|
|
|
|
|
3
|
return; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
1
|
|
|
|
|
84
|
$self->method->next; |
291
|
|
|
|
|
|
|
|
292
|
1
|
|
|
|
|
3
|
return 1; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
sub step_all { |
307
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
308
|
1
|
|
|
|
|
2
|
my $steps = 1; |
309
|
1
|
|
|
|
|
4
|
while ( $self->step ) { |
310
|
1
|
|
|
|
|
4
|
$steps++; |
311
|
|
|
|
|
|
|
} |
312
|
1
|
|
|
|
|
21
|
return $steps; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
316
|
2
|
|
|
2
|
|
1050
|
no Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
1; |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
__END__ |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=pod |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=encoding UTF-8 |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head1 NAME |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Git::PurePerl::Walker - Walk over a sequence of commits in a Git::PurePerl repo |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head1 VERSION |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
version 0.004001 |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=head1 SYNOPSIS |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
use Git::PurePerl::Walker; |
337
|
|
|
|
|
|
|
use Git::PurePerl::Walker::Method::FirstParent; |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
my $repo = Git::PurePerl->new( ... ); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
my $walker = Git::PurePerl::Walker->new( |
342
|
|
|
|
|
|
|
repo => $repo, |
343
|
|
|
|
|
|
|
method => Git::PurePerl::Walker::Method::FirstParent->new( |
344
|
|
|
|
|
|
|
start => $repo->ref_sha1('refs/heads/master'), |
345
|
|
|
|
|
|
|
), |
346
|
|
|
|
|
|
|
on_commit => sub { |
347
|
|
|
|
|
|
|
my ( $commit ) = @_; |
348
|
|
|
|
|
|
|
print $commit->sha1; |
349
|
|
|
|
|
|
|
}, |
350
|
|
|
|
|
|
|
); |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
$walker->step_all; |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=head1 CONSTRUCTOR ARGUMENTS |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=head2 repo |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
B<Mandatory:> An instance of L<< C<Git::PurePerl>|Git::PurePerl >> representing |
359
|
|
|
|
|
|
|
the repository to work with. |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=head2 method |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
B<Mandatory:> either a C<Str> describing a Class Name Suffix, or an C<Object> |
364
|
|
|
|
|
|
|
that C<does> |
365
|
|
|
|
|
|
|
L<< |
366
|
|
|
|
|
|
|
C<Git::PurePerl::B<Walker::Role::Method>>|Git::PurePerl::Walker::Role::Method |
367
|
|
|
|
|
|
|
>>. |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
If its a C<Str>, the C<Str> will be expanded as follows: |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
->new( |
372
|
|
|
|
|
|
|
... |
373
|
|
|
|
|
|
|
method => 'Foo', |
374
|
|
|
|
|
|
|
... |
375
|
|
|
|
|
|
|
); |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
$className = 'Git::PurePerl::Walker::Method::Foo' |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
And the resulting class will be loaded, and instantiated for you. ( Assuming of |
380
|
|
|
|
|
|
|
course, you don't need to pass any fancy args ). |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
If you need fancy args, or a class outside the |
383
|
|
|
|
|
|
|
C<Git::PurePerl::B<Walker::Method::>> namespace, constructing the object will |
384
|
|
|
|
|
|
|
have to be your responsibility. |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
->new( |
387
|
|
|
|
|
|
|
... |
388
|
|
|
|
|
|
|
method => Foo::Class->new(), |
389
|
|
|
|
|
|
|
... |
390
|
|
|
|
|
|
|
) |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=head2 on_commit |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
B<Mandatory:> either a C<Str> that can be expanded in a way similar to that by |
395
|
|
|
|
|
|
|
L<< C<I<method>>|/method >>, a C<CodeRef>, or an object that C<does> L<< |
396
|
|
|
|
|
|
|
C<Git::PurePerl::B<Walker::Role::OnCommit>>|Git::PurePerl::Walker::Role::OnCommit |
397
|
|
|
|
|
|
|
>>. |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
If passed a C<Str> it will be expanded like so: |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
->new( |
402
|
|
|
|
|
|
|
... |
403
|
|
|
|
|
|
|
on_commit => $str, |
404
|
|
|
|
|
|
|
... |
405
|
|
|
|
|
|
|
); |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
$class = 'Git::PurePerl::Walker::OnCommit::' . $str; |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
And the resulting class loaded and instantiated. |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
If passed a C<CodeRef>, |
412
|
|
|
|
|
|
|
L<< |
413
|
|
|
|
|
|
|
C<Git::PurePerl::B<Walker::OnCommit::CallBack>>|Git::PurePerl::Walker::OnCommit::CallBack |
414
|
|
|
|
|
|
|
>> will be loaded and your C<CodeRef> will be passed as an argument. |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
->new( |
417
|
|
|
|
|
|
|
... |
418
|
|
|
|
|
|
|
on_commit => sub { |
419
|
|
|
|
|
|
|
my ( $commit ) = @_; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
}, |
422
|
|
|
|
|
|
|
... |
423
|
|
|
|
|
|
|
); |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
If you need anything fancier, or requiring an unusual namespace, you'll want to |
426
|
|
|
|
|
|
|
construct the object yourself. |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
->new( |
429
|
|
|
|
|
|
|
... |
430
|
|
|
|
|
|
|
on_commit => Foo::Package->new() |
431
|
|
|
|
|
|
|
... |
432
|
|
|
|
|
|
|
); |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=head1 METHODS |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=head2 reset |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
$walker->reset(); |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
Reset the walk routine back to the state it was before you walked. |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=head2 step |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
Increments one step forward in the git history, and dispatches the object to the |
445
|
|
|
|
|
|
|
C<OnCommit> handlers. |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
If there are more possible steps to take, it will return a true value. |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
while ( $walker->step ) { |
450
|
|
|
|
|
|
|
/* Code to execute if walker has more items */ |
451
|
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
This code is almost identical to: |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
while(1) { |
456
|
|
|
|
|
|
|
$walker->on_commit->handle( $walker->method->current ); |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
last if not $walker->method->has_next; |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
$walker->method->next; |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
/* Code to execute if walker has more items */ |
463
|
|
|
|
|
|
|
} |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=head2 step_all |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
my $steps = $walker->step_all; |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
Mostly a convenience method to iterate until it can iterate no more, but without |
470
|
|
|
|
|
|
|
you needing to wrap it in a while() block. |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
Returns the number of steps executed. |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=head2 repo |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
=head2 method |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=head2 on_commit |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=head1 ATTRIBUTE GENERATED METHODS |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=head2 repo |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
# Getter |
487
|
|
|
|
|
|
|
my $repo = $walker->repo(); |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=head2 method |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
# Getter |
492
|
|
|
|
|
|
|
my $method_object = $walker->method(); |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=head2 on_commit |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
# Getter |
497
|
|
|
|
|
|
|
my $on_commit_object = $walker->on_commit(); |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=head1 PRIVATE ATTRIBUTES |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=head2 _method |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=head2 _on_commit |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
=head2 _build_repo |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=head2 _build_method |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=head2 _build_on_commit |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
=head1 PRIVATE ATTRIBUTE GENERATED METHODS |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
=head2 _method |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
# Getter |
518
|
|
|
|
|
|
|
my $methodish = $walker->_method(); |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=head2 _on_commit |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
# Getter |
523
|
|
|
|
|
|
|
my $on_commitish => $walker->_on_commit(); |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=for Pod::Coverage BUILD |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=head1 AUTHOR |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentnl@cpan.org>. |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
536
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=cut |