blib/lib/Pinto/Action/Log.pm

filter: Statementstmt 91.1% 41 / 45 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 86.8% 53 / 61 CC 4 SCAR 8.0
CC
4
Cov
86%
execute
4.7
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« blib/lib/Pinto/Action/Roots.pm ↑ Summary blib/lib/Pinto/IndexReader.pm »
1 # ABSTRACT: Show revision log for a stack
2  
3 package Pinto::Action::Log;
4  
5 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use MooseX::Types::Moose qw(Str Bool);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use MooseX::MarkAsMethods ( autoclean => 1 );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Pinto::Difference;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Pinto::RevisionWalker;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Pinto::Constants qw(:color);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Pinto::Types qw(StackName StackDefault DiffStyle);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 #------------------------------------------------------------------------------
16  
17 2 our $VERSION = '0.14'; # VERSION
18  
19 #------------------------------------------------------------------------------
20  
21 2 extends qw( Pinto::Action );
22  
23 #------------------------------------------------------------------------------
24  
25 2 has stack => (
26 is => 'ro',
27 isa => StackName | StackDefault,
28 default => undef,
29 );
30  
31 2 has with_diffs => (
32 is => 'ro',
33 isa => Bool,
34 default => 0,
35 );
36  
37 2 has diff_style => (
38 is => 'ro',
39 isa => DiffStyle,
40 predicate => 'has_diff_style',
41 );
42  
43  
44 #------------------------------------------------------------------------------
45  
46 2 ▶sub execute {
Subroutine execute: called CC=4 SCAR=15.4
Pod undocumented
47 2 my ($self) = @_;
48  
49 2 my $stack = $self->repo->get_stack( $self->stack );
50 2 my $walker = Pinto::RevisionWalker->new( start => $stack->head );
51  
52 2 ▶ while ( my $revision = $walker->next ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $revision = $walker->next) 3 2 5
53  
54 3 my $revid = $revision->to_string("revision %I");
55 3 $self->show( $revid, { color => $PINTO_PALETTE_COLOR_1 } );
56  
57 3 my $rest = $revision->to_string("Date: %u\nUser: %j\n\n%{4}G\n");
58 3 $self->show($rest);
59  
60 3 ▶ if ($self->with_diffs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->with_diffs) 0 3 3
61 0 my $parent = ($revision->parents)[0];
62 0 ▶ local $ENV{PINTO_DIFF_STYLE} = $self->diff_style if $self->has_diff_style;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_diff_style 0 0 0
63 0 my $diff = Pinto::Difference->new(left => $parent, right => $revision);
64 0 $self->show($diff);
65 }
66 }
67  
68 2 return $self->result;
69 }
70  
71 #------------------------------------------------------------------------------
72  
73 2 __PACKAGE__->meta->make_immutable;
74  
75 #------------------------------------------------------------------------------
76  
77 2 1;
78  
79 __END__
« blib/lib/Pinto/Action/Roots.pm ↑ Summary blib/lib/Pinto/IndexReader.pm »