| 1 | package Git::PurePerl::NewObject::Commit; | ||||||||||
| 2 | 4 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | ▶ | use MooseX::StrictConstructor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use DateTime; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | extends 'Git::PurePerl::NewObject'; | |||||||||
| 9 | |||||||||||
| 10 | 4 | has 'kind' => | |||||||||
| 11 | ( is => 'ro', isa => 'ObjectKind', required => 1, default => 'commit' ); | ||||||||||
| 12 | 4 | has 'tree' => ( is => 'rw', isa => 'Str', required => 1 ); | |||||||||
| 13 | 4 | has 'parent' => ( is => 'rw', isa => 'Str', required => 0 ); | |||||||||
| 14 | 4 | has 'author' => ( is => 'rw', isa => 'Git::PurePerl::Actor', required => 1 ); | |||||||||
| 15 | 4 | has 'authored_time' => ( is => 'rw', isa => 'DateTime', required => 1 ); | |||||||||
| 16 | 4 | has 'committer' => | |||||||||
| 17 | ( is => 'rw', isa => 'Git::PurePerl::Actor', required => 1 ); | ||||||||||
| 18 | 4 | has 'committed_time' => ( is => 'rw', isa => 'DateTime', required => 1 ); | |||||||||
| 19 | 4 | has 'comment' => ( is => 'rw', isa => 'Str', required => 1 ); | |||||||||
| 20 | |||||||||||
| 21 | sub _build_content { | ||||||||||
| 22 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_build_content: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | my $content; | |||||||||
| 24 | |||||||||||
| 25 | 0 | $content .= 'tree ' . $self->tree . "\n"; | |||||||||
| 26 | 0 | ▶ | $content .= 'parent ' . $self->parent . "\n" if $self->parent; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | $content | |||||||||
| 28 | .= "author " | ||||||||||
| 29 | . $self->author->name . ' <' | ||||||||||
| 30 | . $self->author->email . "> " | ||||||||||
| 31 | . $self->authored_time->epoch . " " | ||||||||||
| 32 | . DateTime::TimeZone->offset_as_string( $self->authored_time->offset ) | ||||||||||
| 33 | . "\n"; | ||||||||||
| 34 | 0 | $content | |||||||||
| 35 | .= "committer " | ||||||||||
| 36 | . $self->committer->name . ' <' | ||||||||||
| 37 | . $self->author->email . "> " | ||||||||||
| 38 | . $self->committed_time->epoch . " " | ||||||||||
| 39 | . DateTime::TimeZone->offset_as_string( | ||||||||||
| 40 | $self->committed_time->offset ) | ||||||||||
| 41 | . "\n"; | ||||||||||
| 42 | 0 | $content .= "\n"; | |||||||||
| 43 | 0 | my $comment = $self->comment; | |||||||||
| 44 | 0 | chomp $comment; | |||||||||
| 45 | 0 | $content .= "$comment\n"; | |||||||||
| 46 | |||||||||||
| 47 | 0 | $self->content($content); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||
| 51 | |||||||||||