| 1 | package Git::Repository::Plugin::Diff; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use 5.008_005; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Git::Repository::Plugin; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | our @ISA = qw( Git::Repository::Plugin ); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Git::Repository::Plugin::Diff::Hunk; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | sub _keywords { ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) | ||||||||||||||||||||||||||
|
Subroutine
_keywords: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | return qw( diff ); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub diff { | ||||||||||||||||||||||||||
|
Subroutine
diff: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 0 | my ( $repository, $file, $from_commit, $to_commit ) = @_; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | my $command = | |||||||||||||||||||||||||||
| 24 | $repository->command( 'diff', $from_commit, $to_commit, $file ); | ||||||||||||||||||||||||||||
| 25 | 0 | my @output = $command->final_output(); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my @hunks; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # Parse the output. | ||||||||||||||||||||||||||||
| 30 | my $hunk; | ||||||||||||||||||||||||||||
| 31 | 0 | while (1) { | |||||||||||||||||||||||||||
| 32 | 0 | my $line = shift @output; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ( !defined $line ) { # eof | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | push @hunks, $hunk if $hunk; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 0 | last; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if ( !defined($hunk) and $line !~ /^\@\@/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $hunk or $line =~ /^\@\@/
MC/DC0%0/2
defined $hunk or $line =~ /^\@\@/
defined $hunk
$line =~ /^\@\@/
Truth table0%0/3
A or B
A= defined $hunkB= $line =~ /^\@\@/
| |||||||||||||||||||||||||||||
| 40 | 0 | next; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if ( $line =~ /^@@/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | push @hunks, $hunk if $hunk; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | $hunk = Git::Repository::Plugin::Diff::Hunk->parse_header($line); | |||||||||||||||||||||||||||
| 46 | 0 | next; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | $hunk->add_line($line); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | return @hunks; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 2 | 1; | |||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||