Gitalist/Object/Commit.pm

filter: Statementstmt 34.4% 50 / 145 Branchbran 4.7% 4 / 84 Conditioncond 0.0% 0 / 48 MC/DCmcdc 0.0% 0 / 31 Subroutinesub 71.4% 15 / 21 Podpod n/a totaltotal 20.9% 69 / 329 CC 61 SCAR 52.5
CC
61
Cov
19%
diff
427.7
blame
277.6
get_patch
114.7
CRAP 190.7
↑ Summary Gitalist/Repository.pm »
1 package Git::Gitalist::Object::Commit;
2  
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 extends 'Git::Gitalist::Object';
6 2 with 'Git::Gitalist::Object::HasTree';
7  
8 2 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use MooseX::Types::Moose qw/Str Int Bool Maybe ArrayRef/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use MooseX::Types::Common::String qw/NonEmptySimpleStr SimpleStr/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use List::MoreUtils qw/any zip/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 our $SHA1RE = qr/[0-9a-fA-F]{40}/;
16  
17 2 has '+type' => ( default => 'commit' );
18 2 has '+_gpp_obj' => (
19 handles => [qw(
20 comment
21 tree_sha1
22 committer
23 committed_time
24 author
25 authored_time
26 parents
27 parent_sha1
28 parent_sha1s
29 )],
30 );
31  
32 2 ▶method _build_tree {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build_tree: called CC=2 SCAR=7.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 1 1
33 1 return [$self->repository->get_object($self->tree_sha1)];
34 }
35  
36 2 ▶method sha_by_path ($path) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine sha_by_path: called CC=4 SCAR=14.0
Branch: 2 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 1 1
if scalar @_ > 1 0 1 1
37 1 $path =~ s{/+$}();
38 # FIXME should this really just take the first result?
39 1 ▶ my @paths = $self->repository->run_cmd('ls-tree', $self->sha1, '--', $path)
Branch: 1 branch
BranchTrueFalseTotal
my(@paths) = $self->repository->run_cmd("ls-tree", $self->sha1, "--", $path) or return 1 0 1
40 or return;
41 1 my $line = $paths[0];
42  
43 #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
44 1 $line =~ m/^([0-9]+) (.+) ($SHA1RE)\t/;
45 1 my $sha1 = $3;
46 1 return $self->repository->get_object($sha1);
47 }
48  
49 0 ▶method get_patch ( Maybe[MooseX::Types::Common::String::NonEmptySimpleStr] $parent_hash?,
Subroutine BEGIN: called CC=1 SCAR=4.9
Subroutine get_patch: not called CC=11 SCAR=47.4
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 and not +($Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"))->check($parent_hash) 0 0 0
Condition0%0/6
scalar @_ > 0 and not +($Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"))->check($parent_hash)
!ll&&!rl&&r
000
$Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]")
l!l&&r!l&&!r
000
MC/DC0%0/2
scalar @_ > 0 and not +($Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"))->check($parent_hash)
scalar @_ > 0 not +($Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"))->check($parent_hash)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]")
$Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]")
Truth table0%0/3
A and not(B)
A= scalar @_ > 0B= not +($Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"} ||= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"))->check($parent_hash)
ABresult
0X0
100
111
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]"}B= "Method::Signatures"->_make_constraint("Maybe[MooseX::Types::Common::String::NonEmptySimpleStr]")
ABresult
1X1
011
000
50 0 ▶ Int $patch_count?) {
Branch: 2 branches
BranchTrueFalseTotal
if scalar @_ > 1 and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($patch_count) 0 0 0
if scalar @_ > 2 0 0 0
Condition0%0/6
scalar @_ > 1 and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($patch_count)
!ll&&!rl&&r
000
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
l!l&&r!l&&!r
000
MC/DC0%0/2
scalar @_ > 1 and not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($patch_count)
scalar @_ > 1 not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($patch_count)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int")
$Method::Signatures::mutc{"cache"}{"Int"} "Method::Signatures"->_make_constraint("Int")
Truth table0%0/3
A and not(B)
A= scalar @_ > 1B= not +($Method::Signatures::mutc{"cache"}{"Int"} ||= "Method::Signatures"->_make_constraint("Int"))->check($patch_count)
ABresult
0X0
100
111
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Int"}B= "Method::Signatures"->_make_constraint("Int")
ABresult
1X1
011
000
51 # assembling the git command to execute...
52 0 my @cmd = qw/format-patch --encoding=utf8 --stdout/;
53  
54 # patch, or patch set?
55 0 ▶ push @cmd,
Branch: 1 branch
BranchTrueFalseTotal
defined $patch_count ? : 0 0 0
56 defined $patch_count
57 ? "-$patch_count -n" : "-1";
58  
59 # refspec
60 0 ▶ if (defined $parent_hash) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parent_hash) { } 0 0 0
61 # if a parent is specified: hp..h
62 0 push @cmd, "$parent_hash.." . $self->sha1;
63 } else {
64 # if not, but a merge commit: --cc h
65 # otherwise: --root h
66 0 ▶ push @cmd, length($self->parents) > 1
Branch: 1 branch
BranchTrueFalseTotal
length $self->parents > 1 ? : 0 0 0
67 ? '--cc' : '--root';
68 0 push @cmd, $self->sha1;
69 }
70 0 return $self->_run_cmd_fh( @cmd );
71 }
72  
73 0 ▶method diff ( Bool :$patch?,
Subroutine BEGIN: called CC=1 SCAR=5.1
Subroutine diff: not called CC=21 SCAR=60.6
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"patch"} and not +($Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool "))->check($patch) 0 0 0
Condition0%0/6
exists $args{"patch"} and not +($Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool "))->check($patch)
!ll&&!rl&&r
000
$Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool ")
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $args{"patch"} and not +($Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool "))->check($patch)
exists $args{"patch"} not +($Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool "))->check($patch)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool ")
$Method::Signatures::mutc{"cache"}{"Bool "} "Method::Signatures"->_make_constraint("Bool ")
Truth table0%0/3
A and not(B)
A= exists $args{"patch"}B= not +($Method::Signatures::mutc{"cache"}{"Bool "} ||= "Method::Signatures"->_make_constraint("Bool "))->check($patch)
ABresult
0X0
100
111
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"Bool "}B= "Method::Signatures"->_make_constraint("Bool ")
ABresult
1X1
011
000
74 0 ▶ MooseX::Types::Common::String::NonEmptySimpleStr :$parent?,
Branch: 1 branch
BranchTrueFalseTotal
if exists $args{"parent"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($parent) 0 0 0
Condition0%0/6
exists $args{"parent"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($parent)
!ll&&!rl&&r
000
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $args{"parent"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($parent)
exists $args{"parent"} not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($parent)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table0%0/3
A and not(B)
A= exists $args{"parent"}B= not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($parent)
ABresult
0X0
100
111
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
ABresult
1X1
011
000
75 0 ▶ MooseX::Types::Common::String::NonEmptySimpleStr :$filename?
Branch: 3 branches
BranchTrueFalseTotal
if exists $args{"filename"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($filename) 0 0 0
if keys %args 0 0 0
if scalar @_ > 6 0 0 0
Condition0%0/6
exists $args{"filename"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($filename)
!ll&&!rl&&r
000
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $args{"filename"} and not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($filename)
exists $args{"filename"} not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($filename)
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
Truth table0%0/3
A and not(B)
A= exists $args{"filename"}B= not +($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($filename)
ABresult
0X0
100
111
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
ABresult
1X1
011
000
76 ) {
77 0 ▶ $parent = $parent
Branch: 2 branches
BranchTrueFalseTotal
$parent ? : 0 0 0
$self->parents <= 1 ? : 0 0 0
78 ? $parent
79 : $self->parents <= 1
80 ? $self->parent_sha1
81 : '-c';
82 0 ▶ my @etc = (
Branch: 1 branch
BranchTrueFalseTotal
$filename ? : 0 0 0
83 ( $filename ? ('--', $filename) : () ),
84 );
85  
86 # If we're not comparing against something and we have multiple
87 # parents then it's a merge commit so show what was merged.
88 0 ▶ my $sha1 = $parent && $parent eq '-c' && @{[$self->parents]} > 1
Branch: 1 branch
BranchTrueFalseTotal
$parent && $parent eq '-c' && @{[$self->parents];} > 1 ? : 0 0 0
Condition0%0/6
$parent and $parent eq "-c" and @{[$self->parents];} > 1
!ll&&!rl&&r
000
$parent and $parent eq "-c"
!ll&&!rl&&r
000
MC/DC0%0/3
$parent and $parent eq "-c" and @{[$self->parents];} > 1
$parent $parent eq "-c" @{[$self->parents];} > 1
Truth table0%0/4
A and B and C
A= $parentB= $parent eq "-c"C= @{[$self->parents];} > 1
ABCresult
0XX0
10X0
1100
1111
89 ? sprintf("%s^1..%s^2", ($self->sha1) x 2)
90 : $self->sha1;
91  
92 0 ▶ my @out = $self->_raw_diff(
Branch: 2 branches
BranchTrueFalseTotal
$patch ? : 0 0 0
$parent ? : 0 0 0
93 ( $patch ? '--patch-with-raw' : () ),
94 ( $parent ? $parent : () ),
95 $sha1, @etc,
96 );
97  
98 # XXX Yes, there is much wrongness having _parse_diff_tree be destructive.
99 0 my @difftree = $self->_parse_diff_tree(\@out);
100  
101 return \@difftree
102 0 ▶ unless $patch;
Branch: 1 branch
BranchTrueFalseTotal
unless $patch 0 0 0
103  
104 # The blank line between the tree and the patch.
105 0 shift @out;
106  
107 # XXX And no I'm not happy about having diff return tree + patch.
108 0 return \@difftree, [$self->_parse_diff(@out)];
109 }
110  
111 ## Private methods
112 # gitweb uses the following sort of command for diffing merges:
113 # /home/dbrook/apps/bin/git --git-dir=/home/dbrook/dev/app/.git diff-tree -r -M --no-commit-id --patch-with-raw --full-index --cc 316cf158df3f6207afbae7270bcc5ba0 --
114 # and for regular diffs
115 # /home/dbrook/apps/bin/git --git-dir=/home/dbrook/dev/app/.git diff-tree -r -M --no-commit-id --patch-with-raw --full-index 2e3454ca0749641b42f063730b0090e1 316cf158df3f6207afbae7270bcc5ba0 --
116 0 ▶method _raw_diff (@args) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _raw_diff: not called CC=1 SCAR=2.0
117 0 return $self->_run_cmd_list(
118 qw(diff-tree -r -M --no-commit-id --full-index),
119 @args
120 );
121 }
122  
123 0 ▶method _parse_diff_tree ($diff) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine _parse_diff_tree: not called CC=7 SCAR=38.5
Branch: 2 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
if scalar @_ > 1 0 0 0
124 0 my @keys = qw(modesrc modedst sha1src sha1dst status src dst);
125 0 my @ret;
126 0 ▶ while (@$diff and $diff->[0] =~ /^:\d+/) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$diff and $diff->[0] =~ /^:\d+/) 0 0 0
Condition0%0/3
@$diff and $diff->[0] =~ /^:\d+/
!ll&&!rl&&r
000
MC/DC0%0/2
@$diff and $diff->[0] =~ /^:\d+/
@$diff $diff->[0] =~ /^:\d+/
Truth table0%0/3
A and B
A= @$diffB= $diff->[0] =~ /^:\d+/
ABresult
0X0
100
111
127 0 my $line = shift @$diff;
128 # see. man git-diff-tree for more info
129 # mode src, mode dst, sha1 src, sha1 dst, status, src[, dst]
130 0 my @vals = $line =~ /^:(\d+) (\d+) ($SHA1RE) ($SHA1RE) ([ACDMRTUX]\d*)\t([^\t]+)(?:\t([^\n]+))?$/;
131 0 my %line = zip @keys, @vals;
132 # Some convenience keys
133 0 $line{file} = $line{src};
134 0 $line{sha1} = $line{sha1dst};
135 $line{is_new} = $line{sha1src} =~ /^0+$/
136 0 ▶ if $line{sha1src};
Branch: 1 branch
BranchTrueFalseTotal
if $line{"sha1src"} 0 0 0
137 @line{qw/status sim/} = $line{status} =~ /(R)0*(\d+)/
138 0 ▶ if $line{status} =~ /^R/;
Branch: 1 branch
BranchTrueFalseTotal
if $line{"status"} =~ /^R/ 0 0 0
139 0 push @ret, \%line;
140 }
141  
142 0 return @ret;
143 }
144  
145 0 ▶method _parse_diff (@diff) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine _parse_diff: not called CC=5 SCAR=31.6
146 0 my @ret;
147 0 for (@diff) {
148 # This regex is a little pathological.
149 0 ▶ if (m{^diff --git (a/(.*?)) (b/\2)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (m[^diff --git (a/(.*?)) (b/\2)]) 0 0 0
150 0 push @ret, {
151 head => $_,
152 a => $1,
153 b => $3,
154 file => $2,
155 diff => '',
156 };
157 0 next;
158 }
159  
160 0 ▶ if (/^index (\w+)\.\.(\w+)(?: (\d+))?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/^index (\w+)\.\.(\w+)(?: (\d+))?$/) 0 0 0
161 0 @{$ret[-1]}{qw(index src dst mode)} = ($_, $1, $2, $3);
162 next
163 0 }
164  
165 # XXX Somewhat hacky. Ahem.
166 0 ▶ $ret[@ret ? -1 : 0]{diff} .= "$_\n";
Branch: 1 branch
BranchTrueFalseTotal
@ret ? : 0 0 0
167 }
168  
169 0 return @ret;
170 }
171  
172  
173 # XXX A prime candidate for caching.
174 0 ▶method blame ( MooseX::Types::Common::String::NonEmptySimpleStr $filename, MooseX::Types::Common::String::SimpleStr $sha1 ) {
Subroutine BEGIN: called CC=1 SCAR=5.8
Subroutine blame: not called CC=17 SCAR=56.3
Branch: 5 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr"))->check($filename) 0 0 0
unless scalar @_ > 1 0 0 0
unless ($Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::SimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::SimpleStr"))->check($sha1) 0 0 0
if scalar @_ > 2 0 0 0
Condition0%0/6
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
l!l&&r!l&&!r
000
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::SimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::SimpleStr")
l!l&&r!l&&!r
000
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"} "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::SimpleStr"} ||= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::SimpleStr")
$Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::SimpleStr"} "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::SimpleStr")
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::NonEmptySimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::NonEmptySimpleStr")
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"MooseX::Types::Common::String::SimpleStr"}B= "Method::Signatures"->_make_constraint("MooseX::Types::Common::String::SimpleStr")
ABresult
1X1
011
000
175 0 ▶ my @blameout = $self->_run_cmd_list(
Branch: 1 branch
BranchTrueFalseTotal
$sha1 ? : 0 0 0
176 blame => '-p', $sha1 ? $sha1 : $self->sha1, '--', $filename
177 );
178  
179 0 my(%commitdata, @filedata);
180 0 ▶ while(defined(local $_ = shift @blameout)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(local $_ = shift @blameout)) 0 0 0
181 0 my ($sha1, $orig_lineno, $lineno, $group_size) =
182 /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/;
183  
184 $commitdata{$sha1} = {}
185 0 ▶ unless exists $commitdata{$sha1};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $commitdata{$sha1} 0 0 0
186  
187 0 my $commit = $commitdata{$sha1};
188 0 my $line;
189  
190 0 ▶ until(@blameout == 0 || ($line = shift @blameout) =~ s/^\t//) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@blameout == 0 or ($line = shift @blameout) =~ s/^\t//) 0 0 0
Condition0%0/3
@blameout == 0 or ($line = shift @blameout) =~ s/^\t//
l!l&&r!l&&!r
000
MC/DC0%0/2
@blameout == 0 or ($line = shift @blameout) =~ s/^\t//
@blameout == 0 ($line = shift @blameout) =~ s/^\t//
Truth table0%0/3
A or B
A= @blameout == 0B= ($line = shift @blameout) =~ s/^\t//
ABresult
1X1
011
000
191 0 ▶ $commit->{$1} = $2 if $line =~ /^(\S+) (.*)/;
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^(\S+) (.*)/ 0 0 0
192 }
193  
194 0 ▶ unless(exists $commit->{author_dt}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $commit->{"author_dt"}) 0 0 0
195 0 for my $t (qw/author committer/) {
196 0 my $dt = DateTime->from_epoch(epoch => $commit->{"$t-time"});
197 0 $dt->set_time_zone($commit->{"$t-tz"});
198 0 $commit->{"$t\_dt"} = $dt;
199 }
200 }
201  
202 0 ▶ push @filedata, {
Branch: 1 branch
BranchTrueFalseTotal
$group_size ? : 0 0 0
203 line => $line,
204 commit => { sha1 => $sha1, %$commit },
205 meta => {
206 orig_lineno => $orig_lineno,
207 lineno => $lineno,
208 ( $group_size ? (group_size => $group_size) : () ),
209 },
210 };
211 }
212  
213 0 return \@filedata;
214 }
215  
216 2 1;
217  
218 __END__
↑ Summary Gitalist/Repository.pm »