| 1 | use 5.008; # utf8 | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use utf8; | ||
| 5 | |||
| 6 | package Git::PurePerl::Walker::Method::FirstParent::FromHEAD; | ||
| 7 | |||
| 8 | our $VERSION = '0.004000'; | ||
| 9 | |||
| 10 | # ABSTRACT: Start at the HEAD of the current repo. | ||
| 11 | |||
| 12 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | ||
| 13 | |||
| 14 | use Moose qw( extends has ); | ||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | extends 'Git::PurePerl::Walker::Method::FirstParent'; | ||
| 23 | |||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | |||
| 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 | has '+start' => ( | ||
| 62 | init_arg => undef, | ||
| 63 | lazy_build => 1, | ||
| 64 | required => 0, | ||
| 65 | ); | ||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | has '+_repo' => ( predicate => '_has_repo', ); | ||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | sub _build_start { | ||
| 78 | my $self = shift; | ||
| 79 | if ( not $self->_has_repo ) { | ||
| 80 | require Carp; | ||
| 81 | Carp::confess('No repo defined while trying to find a starting commit'); | ||
| 82 | } | ||
| 83 | return $self->_repo->head_sha1; | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 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 | no Moose; | ||
| 141 | __PACKAGE__->meta->make_immutable; | ||
| 142 | 1; | ||
| 143 | |||
| 144 | __END__ | ||
| 145 | |||
| 146 | =pod | ||
| 147 | |||
| 148 | =encoding UTF-8 | ||
| 149 | |||
| 150 | =head1 NAME | ||
| 151 | |||
| 152 | Git::PurePerl::Walker::Method::FirstParent::FromHEAD - Start at the HEAD of the current repo. | ||
| 153 | |||
| 154 | =head1 VERSION | ||
| 155 | |||
| 156 | version 0.004000 | ||
| 157 | |||
| 158 | =head1 INHERITED METHODS | ||
| 159 | |||
| 160 | =head2 for_repository | ||
| 161 | |||
| 162 | L<< | ||
| 163 | C<Git::PurePerl::B<Walker::Role::HasRepo>-E<gt>I<for_repository( $repo )>> | ||
| 164 | |Git::PurePerl::Walker::Role::HasRepo/for_repository | ||
| 165 | >> | ||
| 166 | |||
| 167 | =head2 clone | ||
| 168 | |||
| 169 | L<< | ||
| 170 | C<MooseX::B<Clone>-E<gt>I<clone( %params )>> | ||
| 171 | |MooseX::Clone/clone-params | ||
| 172 | >> | ||
| 173 | |||
| 174 | =head2 _repo | ||
| 175 | |||
| 176 | L<< C<Git::PurePerl::B<Walker::Role::HasRepo>-E<gt>I<_repo( $repo )>>|Git::PurePerl::Walker::Role::HasRepo/_repo >> | ||
| 177 | |||
| 178 | =head2 start | ||
| 179 | |||
| 180 | L<< C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<start( $commit )>>|Git::PurePerl::Walker::Method::FirstParent/start >> | ||
| 181 | |||
| 182 | =head2 _commit | ||
| 183 | |||
| 184 | L<< | ||
| 185 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<_commit( $commit_object )>> | ||
| 186 | |Git::PurePerl::Walker::Method::FirstParent/_commit | ||
| 187 | >> | ||
| 188 | |||
| 189 | =head2 _build_commit | ||
| 190 | |||
| 191 | L<< | ||
| 192 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<_build_commit()>> | ||
| 193 | |Git::PurePerl::Walker::Method::FirstParent/_build_commit | ||
| 194 | >> | ||
| 195 | |||
| 196 | =head2 current | ||
| 197 | |||
| 198 | L<< | ||
| 199 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<current()>> | ||
| 200 | |Git::PurePerl::Walker::Method::FirstParent/current | ||
| 201 | >> | ||
| 202 | |||
| 203 | =head2 has_next | ||
| 204 | |||
| 205 | L<< | ||
| 206 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<has_next()>> | ||
| 207 | |Git::PurePerl::Walker::Method::FirstParent/has_next | ||
| 208 | >> | ||
| 209 | |||
| 210 | =head2 next | ||
| 211 | |||
| 212 | L<< | ||
| 213 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<next()>> | ||
| 214 | |Git::PurePerl::Walker::Method::FirstParent/next | ||
| 215 | >> | ||
| 216 | |||
| 217 | =head2 peek_next | ||
| 218 | |||
| 219 | L<< | ||
| 220 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<peek_next()>> | ||
| 221 | |Git::PurePerl::Walker::Method::FirstParent/peek_next | ||
| 222 | >> | ||
| 223 | |||
| 224 | =head2 reset | ||
| 225 | |||
| 226 | L<< | ||
| 227 | C<Git::PurePerl::B<Walker::Method::FirstParent>-E<gt>I<reset()>> | ||
| 228 | |Git::PurePerl::Walker::Method::FirstParent/reset | ||
| 229 | >> | ||
| 230 | |||
| 231 | =head1 PRIVATE METHODS | ||
| 232 | |||
| 233 | =head2 _build_start | ||
| 234 | |||
| 235 | =head1 PRIVATE ATTRIBUTE GENERATED METHODS | ||
| 236 | |||
| 237 | =head2 _has_repo | ||
| 238 | |||
| 239 | =head1 EXTENDS | ||
| 240 | |||
| 241 | =head2 Git::PurePerl::Walker::Method::FirstParent | ||
| 242 | |||
| 243 | L<< C<Git::PurePerl::B<Walker::Method::FirstParent>>|Git::PurePerl::Walker::Method::FirstParent >> | ||
| 244 | |||
| 245 | =head1 AUTHOR | ||
| 246 | |||
| 247 | Kent Fredric <kentnl@cpan.org> | ||
| 248 | |||
| 249 | =head1 COPYRIGHT AND LICENSE | ||
| 250 | |||
| 251 | This software is copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>. | ||
| 252 | |||
| 253 | This is free software; you can redistribute it and/or modify it under | ||
| 254 | the same terms as the Perl 5 programming language system itself. | ||
| 255 | |||
| 256 | =cut |