| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | package CVS::Metrics; | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '0.18'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use POSIX qw(mktime); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub insertHead { | ||||||||||||||||||||||||||
|
Subroutine
insertHead: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | foreach my $file (values %{$cvs_log}) { | |||||||||||||||||||||||||||
| 15 | 0 | my $head = $file->{head}; | |||||||||||||||||||||||||||
| 16 | 0 | my $state = $file->{description}->{$head}->{state}; | |||||||||||||||||||||||||||
| 17 | 0 | ▶ | if ($state eq 'Exp') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 0 | $file->{'symbolic names'}->{HEAD} = $head; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub getTagname { | ||||||||||||||||||||||||||
|
Subroutine
getTagname: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 25 | 0 | my ($regex_ignore) = @_; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my %tagname; | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | next if ($regex_ignore and $filename =~ /$regex_ignore/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$regex_ignore and $filename =~ /$regex_ignore/
MC/DC0%0/2
$regex_ignore and $filename =~ /$regex_ignore/
$regex_ignore
$filename =~ /$regex_ignore/
Truth table0%0/3
A and B
A= $regex_ignoreB= $filename =~ /$regex_ignore/
| |||||||||||||||||||||||||||||
| 30 | 0 | foreach (keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | unless (exists $tagname{$_}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 0 | $tagname{$_} = 1; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | 0 | return keys %tagname; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub getTimedTag { | ||||||||||||||||||||||||||
|
Subroutine
getTimedTag: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 41 | 0 | my ($regex_ignore) = @_; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | my %timed; | |||||||||||||||||||||||||||
| 44 | # open my $LOG, '>', 'timed.log'; | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | next if ($regex_ignore and $filename =~ /$regex_ignore/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$regex_ignore and $filename =~ /$regex_ignore/
MC/DC0%0/2
$regex_ignore and $filename =~ /$regex_ignore/
$regex_ignore
$filename =~ /$regex_ignore/
Truth table0%0/3
A and B
A= $regex_ignoreB= $filename =~ /$regex_ignore/
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | while (my ($tag, $rev_name) = each %{$file->{'symbolic names'}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | my $rev = $file->{description}->{$rev_name}; | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | next unless (exists $rev->{date}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | my $date = $rev->{date}; | |||||||||||||||||||||||||||
| 51 | 0 | ▶ | if (exists $timed{$tag}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if ($date gt $timed{$tag}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | $timed{$tag} = $date; | |||||||||||||||||||||||||||
| 54 | # print $LOG "$tag $filename $date\n"; | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | else { | ||||||||||||||||||||||||||||
| 58 | 0 | $timed{$tag} = $date; | |||||||||||||||||||||||||||
| 59 | # print $LOG "$tag $filename $date\n"; | ||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | # close $LOG; | ||||||||||||||||||||||||||||
| 64 | 0 | return \%timed; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub getBranchname { | ||||||||||||||||||||||||||
|
Subroutine
getBranchname: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 69 | 0 | my ($regex_ignore) = @_; | |||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | my %tagname; | |||||||||||||||||||||||||||
| 72 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 0 | ▶ | next if ($regex_ignore and $filename =~ /$regex_ignore/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$regex_ignore and $filename =~ /$regex_ignore/
MC/DC0%0/2
$regex_ignore and $filename =~ /$regex_ignore/
$regex_ignore
$filename =~ /$regex_ignore/
Truth table0%0/3
A and B
A= $regex_ignoreB= $filename =~ /$regex_ignore/
| |||||||||||||||||||||||||||||
| 74 | 0 | foreach (keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 75 | 0 | my $rev = $file->{'symbolic names'}->{$_}; | |||||||||||||||||||||||||||
| 76 | 0 | ▶ | next unless ($rev =~ /\.0\./); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | unless (exists $tagname{$_}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | $tagname{$_} = 1; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | 0 | return keys %tagname; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub _Energy { | ||||||||||||||||||||||||||
|
Subroutine
_Energy: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||
| 86 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 87 | 0 | my ($tags, $path) = @_; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | my @diffs; | |||||||||||||||||||||||||||
| 90 | 0 | my @tags0 = @{$tags}; | |||||||||||||||||||||||||||
| 91 | 0 | my @tags1 = @{$tags}; | |||||||||||||||||||||||||||
| 92 | 0 | shift @tags1; | |||||||||||||||||||||||||||
| 93 | 0 | foreach (@tags1) { | |||||||||||||||||||||||||||
| 94 | 0 | my $diff = shift(@tags0) . '-' . $_; | |||||||||||||||||||||||||||
| 95 | 0 | push @diffs, $diff; | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | my %size; | |||||||||||||||||||||||||||
| 99 | 0 | foreach my $tag (@{$tags}) { | |||||||||||||||||||||||||||
| 100 | 0 | $size{$tag} = 0; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | my %delta; | |||||||||||||||||||||||||||
| 104 | 0 | foreach my $diff (@diffs) { | |||||||||||||||||||||||||||
| 105 | 0 | $delta{$diff} = 0; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | next unless ($filename =~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | my @rev0; | |||||||||||||||||||||||||||
| 111 | 0 | foreach my $tag (@{$tags}) { | |||||||||||||||||||||||||||
| 112 | 0 | ▶ | if (exists $file->{'symbolic names'}->{$tag}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 0 | $size{$tag} ++; | |||||||||||||||||||||||||||
| 114 | 0 | push @rev0, $file->{'symbolic names'}->{$tag}; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | else { | ||||||||||||||||||||||||||||
| 117 | 0 | push @rev0, q{}; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 0 | my @rev1 = @rev0; | |||||||||||||||||||||||||||
| 121 | 0 | shift @rev1; | |||||||||||||||||||||||||||
| 122 | 0 | foreach my $diff (@diffs) { | |||||||||||||||||||||||||||
| 123 | 0 | my $rev0 = shift @rev0; | |||||||||||||||||||||||||||
| 124 | 0 | my $rev1 = shift @rev1; | |||||||||||||||||||||||||||
| 125 | 0 | ▶ | if ($rev1 and $rev0 ne $rev1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev1 and $rev0 ne $rev1
MC/DC0%0/2
$rev1 and $rev0 ne $rev1
$rev1
$rev0 ne $rev1
Truth table0%0/3
A and B
A= $rev1B= $rev0 ne $rev1
| |||||||||||||||||||||||||||||
| 126 | 0 | $delta{$diff} ++; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | my %cumul; | |||||||||||||||||||||||||||
| 132 | 0 | $cumul{$tags->[0]} = 0; | |||||||||||||||||||||||||||
| 133 | 0 | @tags0 = @{$tags}; | |||||||||||||||||||||||||||
| 134 | 0 | @tags1 = @{$tags}; | |||||||||||||||||||||||||||
| 135 | 0 | shift @tags1; | |||||||||||||||||||||||||||
| 136 | 0 | foreach my $tag1 (@tags1) { | |||||||||||||||||||||||||||
| 137 | 0 | my $tag0 = shift @tags0; | |||||||||||||||||||||||||||
| 138 | 0 | my $diff = $tag0 . '-' . $tag1; | |||||||||||||||||||||||||||
| 139 | 0 | $cumul{$tag1} = $cumul{$tag0} + $delta{$diff}; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | my @data = (); | |||||||||||||||||||||||||||
| 143 | 0 | foreach my $tag (@{$tags}) { | |||||||||||||||||||||||||||
| 144 | 0 | push @data, $cumul{$tag}; # x | |||||||||||||||||||||||||||
| 145 | 0 | push @data, $size{$tag}; # y | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | return \@data; | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub getTimedEvolution { | ||||||||||||||||||||||||||
|
Subroutine
getTimedEvolution: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 152 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 153 | 0 | my ($path) = @_; | |||||||||||||||||||||||||||
| 154 | 0 | my %evol; | |||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | next if ($path ne '.' and $filename !~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path ne "." and not $filename =~ /^$path/
MC/DC0%0/2
$path ne "." and not $filename =~ /^$path/
$path ne "."
not $filename =~ /^$path/
Truth table0%0/3
A and not(B)
A= $path ne "."B= not $filename =~ /^$path/
| |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | while (my ($rev_name, $rev) = each %{$file->{description}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | my $date = substr $rev->{date}, 0, 10; # aaaa/mm/jj | |||||||||||||||||||||||||||
| 160 | 0 | ▶ | $evol{$date} = [ 0, 0, 0 ] unless (exists $evol{$date}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ($rev->{state} eq 'dead') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | $evol{$date}->[2] ++; # deleted | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | else { | ||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ($rev_name =~ /^1(\.1)+$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | 0 | $evol{$date}->[0] ++; # added | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | else { | ||||||||||||||||||||||||||||
| 169 | 0 | $evol{$date}->[1] ++; # modified | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | 0 | return \%evol; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | ▶ | sub getDirEvolution { | ||||||||||||||||||||||||||
|
Subroutine
getDirEvolution: not called CC=31 SCAR=69.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 178 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 179 | 0 | my ($path, $tag_from, $tag_to, $tags) = @_; | |||||||||||||||||||||||||||
| 180 | 0 | my %evol; | |||||||||||||||||||||||||||
| 181 | my %tags; | ||||||||||||||||||||||||||||
| 182 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 183 | 0 | foreach (@{$tags}) { | |||||||||||||||||||||||||||
| 184 | 0 | $tags{$_} = ++ $i; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | next if ($path ne '.' and $filename !~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path ne "." and not $filename =~ /^$path/
MC/DC0%0/2
$path ne "." and not $filename =~ /^$path/
$path ne "."
not $filename =~ /^$path/
Truth table0%0/3
A and not(B)
A= $path ne "."B= not $filename =~ /^$path/
| |||||||||||||||||||||||||||||
| 189 | 0 | ▶ | my $rev_from = $file->{'symbolic names'}->{$tag_from} || q{}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$file->{'symbolic names'}{$tag_from} || ''
MC/DC0%0/1
$file->{'symbolic names'}{$tag_from} || ''
$file->{'symbolic names'}{$tag_from}
Truth table0%0/2
A
A= $file->{'symbolic names'}{$tag_from}
| |||||||||||||||||||||||||||||
| 190 | 0 | ▶ | my $rev_to = $file->{'symbolic names'}->{$tag_to} || q{}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$file->{'symbolic names'}{$tag_to} || ''
MC/DC0%0/1
$file->{'symbolic names'}{$tag_to} || ''
$file->{'symbolic names'}{$tag_to}
Truth table0%0/2
A
A= $file->{'symbolic names'}{$tag_to}
| |||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ($rev_from or $rev_to) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_from or $rev_to
MC/DC0%0/2
$rev_from or $rev_to
$rev_from
$rev_to
Truth table0%0/3
A or B
A= $rev_fromB= $rev_to
| |||||||||||||||||||||||||||||
| 192 | 0 | ▶ | next if (cmp_rev($rev_from, $rev_to) == 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||
| 195 | 0 | my $in = 0; | |||||||||||||||||||||||||||
| 196 | 0 | foreach my $tag (sort keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 197 | 0 | ▶ | next unless (exists $tags{$tag}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | $in = 1 if ($tags{$tag} > $tags{$tag_from} | ||||||||||||||||||||||||||||
| 199 | 0 | ▶ | and $tags{$tag} < $tags{$tag_to}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tags{$tag} > $tags{$tag_from} and $tags{$tag} < $tags{$tag_to}
MC/DC0%0/2
$tags{$tag} > $tags{$tag_from} and $tags{$tag} < $tags{$tag_to}
$tags{$tag} > $tags{$tag_from}
$tags{$tag} < $tags{$tag_to}
Truth table0%0/3
A and B
A= $tags{$tag} > $tags{$tag_from}B= $tags{$tag} < $tags{$tag_to}
| |||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | 0 | ▶ | next unless ($in); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | 0 | my $dir = dirname($filename); | |||||||||||||||||||||||||||
| 204 | 0 | ▶ | $evol{$dir} = [ 0, 0, 0 ] unless (exists $evol{$dir}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $evol{$dir}->[0] ++ # added | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | unless ($rev_from); | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | $evol{$dir}->[2] ++ # deleted | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | unless ($rev_to); | ||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if ($rev_from and $rev_to) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_from and $rev_to
MC/DC0%0/2
$rev_from and $rev_to
$rev_from
$rev_to
Truth table0%0/3
A and B
A= $rev_fromB= $rev_to
| |||||||||||||||||||||||||||||
| 210 | 0 | ▶ | next if (cmp_rev($rev_from, $rev_to) == 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | 0 | my $in = 0; | |||||||||||||||||||||||||||
| 212 | 0 | ▶ | while (my ($rev_name, $rev) = each %{$file->{description}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 0 | ▶ | next if ($rev_from and cmp_rev($rev_name, $rev_from) <= 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_from and cmp_rev($rev_name, $rev_from) <= 0
MC/DC0%0/2
$rev_from and cmp_rev($rev_name, $rev_from) <= 0
$rev_from
cmp_rev($rev_name, $rev_from) <= 0
Truth table0%0/3
A and B
A= $rev_fromB= cmp_rev($rev_name, $rev_from) <= 0
| |||||||||||||||||||||||||||||
| 214 | 0 | ▶ | next if ($rev_to and cmp_rev($rev_name, $rev_to) > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_to and cmp_rev($rev_name, $rev_to) > 0
MC/DC0%0/2
$rev_to and cmp_rev($rev_name, $rev_to) > 0
$rev_to
cmp_rev($rev_name, $rev_to) > 0
Truth table0%0/3
A and B
A= $rev_toB= cmp_rev($rev_name, $rev_to) > 0
| |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | next if ($rev_to and !is_ancestor($rev_name, $rev_to)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_to and not is_ancestor($rev_name, $rev_to)
MC/DC0%0/2
$rev_to and not is_ancestor($rev_name, $rev_to)
$rev_to
not is_ancestor($rev_name, $rev_to)
Truth table0%0/3
A and not(B)
A= $rev_toB= not is_ancestor($rev_name, $rev_to)
| |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | next if ($rev_name eq '1.1' and $rev->{state} eq 'dead'); # file was initially added on branch | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_name eq "1.1" and $rev->{"state"} eq "dead"
MC/DC0%0/2
$rev_name eq "1.1" and $rev->{"state"} eq "dead"
$rev_name eq "1.1"
$rev->{"state"} eq "dead"
Truth table0%0/3
A and B
A= $rev_name eq "1.1"B= $rev->{"state"} eq "dead"
| |||||||||||||||||||||||||||||
| 217 | 0 | $in = 1; | |||||||||||||||||||||||||||
| 218 | 0 | last; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $evol{$dir}->[1] ++ # modified | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | if ($in); | ||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | return \%evol; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | sub getEvolution { | ||||||||||||||||||||||||||
|
Subroutine
getEvolution: not called CC=31 SCAR=69.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 228 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 229 | 0 | my ($path, $tag_from, $tag_to, $tags) = @_; | |||||||||||||||||||||||||||
| 230 | 0 | my %evol; | |||||||||||||||||||||||||||
| 231 | my %tags; | ||||||||||||||||||||||||||||
| 232 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 233 | 0 | foreach (@{$tags}) { | |||||||||||||||||||||||||||
| 234 | 0 | $tags{$_} = ++ $i; | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | next if ($path ne '.' and $filename !~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path ne "." and not $filename =~ /^$path/
MC/DC0%0/2
$path ne "." and not $filename =~ /^$path/
$path ne "."
not $filename =~ /^$path/
Truth table0%0/3
A and not(B)
A= $path ne "."B= not $filename =~ /^$path/
| |||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $rev_from = $file->{'symbolic names'}->{$tag_from} || q{}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$file->{'symbolic names'}{$tag_from} || ''
MC/DC0%0/1
$file->{'symbolic names'}{$tag_from} || ''
$file->{'symbolic names'}{$tag_from}
Truth table0%0/2
A
A= $file->{'symbolic names'}{$tag_from}
| |||||||||||||||||||||||||||||
| 240 | 0 | ▶ | my $rev_to = $file->{'symbolic names'}->{$tag_to} || q{}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$file->{'symbolic names'}{$tag_to} || ''
MC/DC0%0/1
$file->{'symbolic names'}{$tag_to} || ''
$file->{'symbolic names'}{$tag_to}
Truth table0%0/2
A
A= $file->{'symbolic names'}{$tag_to}
| |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ($rev_from or $rev_to) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_from or $rev_to
MC/DC0%0/2
$rev_from or $rev_to
$rev_from
$rev_to
Truth table0%0/3
A or B
A= $rev_fromB= $rev_to
| |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | next if (cmp_rev($rev_from, $rev_to) == 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | else { | ||||||||||||||||||||||||||||
| 245 | 0 | my $in = 0; | |||||||||||||||||||||||||||
| 246 | 0 | foreach my $tag (sort keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 247 | 0 | ▶ | next unless (exists $tags{$tag}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | $in = 1 if ($tags{$tag} > $tags{$tag_from} | ||||||||||||||||||||||||||||
| 249 | 0 | ▶ | and $tags{$tag} < $tags{$tag_to}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tags{$tag} > $tags{$tag_from} and $tags{$tag} < $tags{$tag_to}
MC/DC0%0/2
$tags{$tag} > $tags{$tag_from} and $tags{$tag} < $tags{$tag_to}
$tags{$tag} > $tags{$tag_from}
$tags{$tag} < $tags{$tag_to}
Truth table0%0/3
A and B
A= $tags{$tag} > $tags{$tag_from}B= $tags{$tag} < $tags{$tag_to}
| |||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | 0 | ▶ | next unless ($in); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | 0 | my $dir = dirname($filename); | |||||||||||||||||||||||||||
| 254 | 0 | ▶ | $evol{$dir} = {} unless (exists $evol{$dir}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 0 | my $trace = "$filename:"; | |||||||||||||||||||||||||||
| 257 | 0 | foreach (keys %{$file->{description}}) { | |||||||||||||||||||||||||||
| 258 | 0 | $trace .= q{ } . $_; | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | 0 | $trace .= "\n"; | |||||||||||||||||||||||||||
| 261 | 0 | warn $trace; | |||||||||||||||||||||||||||
| 262 | 0 | ▶ | while (my ($rev_name, $rev) = each %{$file->{description}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 263 | # print "$filename $rev_name\n"; | ||||||||||||||||||||||||||||
| 264 | 0 | ▶ | next if ($rev_from and cmp_rev($rev_name, $rev_from) <= 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_from and cmp_rev($rev_name, $rev_from) <= 0
MC/DC0%0/2
$rev_from and cmp_rev($rev_name, $rev_from) <= 0
$rev_from
cmp_rev($rev_name, $rev_from) <= 0
Truth table0%0/3
A and B
A= $rev_fromB= cmp_rev($rev_name, $rev_from) <= 0
| |||||||||||||||||||||||||||||
| 265 | 0 | ▶ | next if ($rev_to and cmp_rev($rev_name, $rev_to) > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_to and cmp_rev($rev_name, $rev_to) > 0
MC/DC0%0/2
$rev_to and cmp_rev($rev_name, $rev_to) > 0
$rev_to
cmp_rev($rev_name, $rev_to) > 0
Truth table0%0/3
A and B
A= $rev_toB= cmp_rev($rev_name, $rev_to) > 0
| |||||||||||||||||||||||||||||
| 266 | 0 | ▶ | next if ($rev_to and !is_ancestor($rev_name, $rev_to)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_to and not is_ancestor($rev_name, $rev_to)
MC/DC0%0/2
$rev_to and not is_ancestor($rev_name, $rev_to)
$rev_to
not is_ancestor($rev_name, $rev_to)
Truth table0%0/3
A and not(B)
A= $rev_toB= not is_ancestor($rev_name, $rev_to)
| |||||||||||||||||||||||||||||
| 267 | 0 | ▶ | next if ($rev_name eq '1.1' and $rev->{state} eq 'dead'); # file was initially added on branch | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev_name eq "1.1" and $rev->{"state"} eq "dead"
MC/DC0%0/2
$rev_name eq "1.1" and $rev->{"state"} eq "dead"
$rev_name eq "1.1"
$rev->{"state"} eq "dead"
Truth table0%0/3
A and B
A= $rev_name eq "1.1"B= $rev->{"state"} eq "dead"
| |||||||||||||||||||||||||||||
| 268 | 0 | my $message = $rev->{message}; | |||||||||||||||||||||||||||
| 269 | # print "$rev_name $message\n"; | ||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $message .= q{ } . $rev->{date} if ($message eq 'no message'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | 0 | my @tags; | |||||||||||||||||||||||||||
| 272 | 0 | ▶ | if ($tag_to eq 'HEAD') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 273 | 0 | foreach my $tag (keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 274 | 0 | ▶ | if (cmp_rev($file->{'symbolic names'}->{$tag}, $rev_name) == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | 0 | push @tags, $tag; | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | $evol{$dir}->{$message} = [] unless (exists $evol{$dir}->{$message}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | 0 | push @{$evol{$dir}->{$message}}, { | |||||||||||||||||||||||||||
| 281 | filename => $filename, | ||||||||||||||||||||||||||||
| 282 | date => $rev->{date}, | ||||||||||||||||||||||||||||
| 283 | author => $rev->{author}, | ||||||||||||||||||||||||||||
| 284 | state => $rev->{state}, | ||||||||||||||||||||||||||||
| 285 | 0 | revision => $rev_name, | |||||||||||||||||||||||||||
| 286 | tags => \@tags, | ||||||||||||||||||||||||||||
| 287 | }; | ||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | 0 | return \%evol; | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub cmp_rev { | ||||||||||||||||||||||||||
|
Subroutine
cmp_rev: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 294 | 0 | my ($rev1, $rev2) = @_; | |||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 0 | ▶ | return 0 unless ($rev1 or $rev2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rev1 or $rev2
MC/DC0%0/2
$rev1 or $rev2
$rev1
$rev2
Truth table0%0/3
A or B
A= $rev1B= $rev2
| |||||||||||||||||||||||||||||
| 297 | 0 | ▶ | return -1 unless ($rev1); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | return 1 unless ($rev2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 299 | 0 | ▶ | return 0 if ($rev1 eq $rev2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 300 | 0 | my @l1 = split /\./, $rev1; | |||||||||||||||||||||||||||
| 301 | 0 | my @l2 = split /\./, $rev2; | |||||||||||||||||||||||||||
| 302 | 0 | foreach my $v1 (@l1) { | |||||||||||||||||||||||||||
| 303 | 0 | my $v2 = shift @l2; | |||||||||||||||||||||||||||
| 304 | 0 | ▶ | return 1 unless (defined $v2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | return 1 if ($v1 > $v2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | return -1 if ($v1 < $v2); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | 0 | return -1; | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | ▶ | sub is_ancestor { | ||||||||||||||||||||||||||
|
Subroutine
is_ancestor: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 312 | 0 | my ($parent, $rev) = @_; | |||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 0 | ▶ | return 1 if ($rev eq $parent); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 0 | ▶ | while ($rev ne '1.1') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | 0 | $rev =~ s/(\d+)$/$1-1/e; | |||||||||||||||||||||||||||
| 317 | 0 | $rev =~ s/\.\d+\.0//; | |||||||||||||||||||||||||||
| 318 | 0 | ▶ | return 1 if ($rev eq $parent); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | 0 | return 0; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 0 | ▶ | sub _Activity { | ||||||||||||||||||||||||||
|
Subroutine
_Activity: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||
| 324 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 325 | 0 | my ($path, $start_date) = @_; | |||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 0 | my $evol = $cvs_log->getTimedEvolution($path); | |||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $start = _get_day($start_date) || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
_get_day($start_date) || 0
MC/DC0%0/1
_get_day($start_date) || 0
_get_day($start_date)
Truth table0%0/2
A
A= _get_day($start_date)
| |||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 0 | my %evol2; | |||||||||||||||||||||||||||
| 332 | 0 | ▶ | while (my ($date, $value) = each %{$evol}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 333 | 0 | my $d = _get_day($date); | |||||||||||||||||||||||||||
| 334 | 0 | ▶ | if (defined $d and $d > $start) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $d and $d > $start
MC/DC0%0/2
defined $d and $d > $start
defined $d
$d > $start
Truth table0%0/3
A and B
A= defined $dB= $d > $start
| |||||||||||||||||||||||||||||
| 335 | 0 | $evol2{sprintf('%08d', $d)} = $value; | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 0 | my @days; | |||||||||||||||||||||||||||
| 340 | my @data; | ||||||||||||||||||||||||||||
| 341 | 0 | my @key_evol2 = sort keys %evol2; | |||||||||||||||||||||||||||
| 342 | 0 | ▶ | my $last_day = $start ? $start : $key_evol2[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 343 | 0 | foreach my $date (@key_evol2) { | |||||||||||||||||||||||||||
| 344 | 0 | foreach ($last_day+1 .. $date-1) { | |||||||||||||||||||||||||||
| 345 | 0 | push @days, $_; | |||||||||||||||||||||||||||
| 346 | 0 | push @data, undef; | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | 0 | my $val = $evol2{$date}; | |||||||||||||||||||||||||||
| 349 | 0 | push @days, $date; | |||||||||||||||||||||||||||
| 350 | 0 | push @data, (${$val}[0] + ${$val}[1]); # added + modified | |||||||||||||||||||||||||||
| 351 | 0 | $last_day = $date; | |||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||
| 353 | 0 | my $now = int(time() / 86400); | |||||||||||||||||||||||||||
| 354 | 0 | foreach ($last_day+1 .. $now) { | |||||||||||||||||||||||||||
| 355 | 0 | push @days, $_; | |||||||||||||||||||||||||||
| 356 | 0 | push @data, undef; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | 0 | return (\@days, \@data); | |||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | 0 | ▶ | sub _get_day { | ||||||||||||||||||||||||||
|
Subroutine
_get_day: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 363 | 0 | my ($date) = @_; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 0 | ▶ | if ($date =~ /^(\d+)[\-\/](\d+)[\-\/](\d+)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 366 | 0 | my $t = POSIX::mktime(0, 0, 0, $3, $2 - 1, $1 - 1900); | |||||||||||||||||||||||||||
| 367 | 0 | return int($t / 86400); | |||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | else { | ||||||||||||||||||||||||||||
| 370 | 0 | warn "_get_day: $date\n"; | |||||||||||||||||||||||||||
| 371 | 0 | return undef; | |||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | 0 | ▶ | sub getRevByTag { | ||||||||||||||||||||||||||
|
Subroutine
getRevByTag: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 376 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 377 | 0 | my ($tags, $path) = @_; | |||||||||||||||||||||||||||
| 378 | 0 | my %evol; | |||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 381 | 0 | ▶ | next if ($path ne '.' and $filename !~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path ne "." and not $filename =~ /^$path/
MC/DC0%0/2
$path ne "." and not $filename =~ /^$path/
$path ne "."
not $filename =~ /^$path/
Truth table0%0/3
A and not(B)
A= $path ne "."B= not $filename =~ /^$path/
| |||||||||||||||||||||||||||||
| 382 | 0 | my $dir = dirname($filename); | |||||||||||||||||||||||||||
| 383 | 0 | ▶ | $evol{$dir} = {} unless (exists $evol{$dir}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | # my $trace = "$filename:"; | ||||||||||||||||||||||||||||
| 385 | # foreach (keys %{$file->{description}}) { | ||||||||||||||||||||||||||||
| 386 | # $trace .= q{ } . $_; | ||||||||||||||||||||||||||||
| 387 | # } | ||||||||||||||||||||||||||||
| 388 | # $trace .= "\n"; | ||||||||||||||||||||||||||||
| 389 | # warn $trace; | ||||||||||||||||||||||||||||
| 390 | 0 | my @rev; | |||||||||||||||||||||||||||
| 391 | 0 | foreach (@{$tags}) { | |||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ($_ eq 'HEAD') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 393 | 0 | push @rev, $file->{'head'}; | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | else { | ||||||||||||||||||||||||||||
| 396 | 0 | ▶ | if (exists $file->{'symbolic names'}->{$_}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 397 | 0 | push @rev, $file->{'symbolic names'}->{$_}; | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | else { | ||||||||||||||||||||||||||||
| 400 | 0 | push @rev, undef; | |||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | 0 | $evol{$dir}->{$filename} = \@rev; | |||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||
| 406 | 0 | return \%evol; | |||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub getBranch { | ||||||||||||||||||||||||||
|
Subroutine
getBranch: not called CC=15 SCAR=54.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 410 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 411 | 0 | my ($path, $branch) = @_; | |||||||||||||||||||||||||||
| 412 | 0 | my %evol; | |||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 415 | 0 | ▶ | next if ($path ne '.' and $filename !~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path ne "." and not $filename =~ /^$path/
MC/DC0%0/2
$path ne "." and not $filename =~ /^$path/
$path ne "."
not $filename =~ /^$path/
Truth table0%0/3
A and not(B)
A= $path ne "."B= not $filename =~ /^$path/
| |||||||||||||||||||||||||||||
| 416 | 0 | my $in = 0; | |||||||||||||||||||||||||||
| 417 | 0 | foreach (keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 418 | 0 | ▶ | $in = 1 if ($_ eq $branch); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||
| 420 | 0 | ▶ | next unless ($in); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 421 | 0 | my $dir = dirname($filename); | |||||||||||||||||||||||||||
| 422 | 0 | ▶ | $evol{$dir} = {} unless (exists $evol{$dir}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | 0 | my $trace = "$filename:"; | |||||||||||||||||||||||||||
| 425 | 0 | foreach (keys %{$file->{description}}) { | |||||||||||||||||||||||||||
| 426 | 0 | $trace .= q{ } . $_; | |||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||
| 428 | 0 | $trace .= "\n"; | |||||||||||||||||||||||||||
| 429 | 0 | warn $trace; | |||||||||||||||||||||||||||
| 430 | 0 | my $rev_base = $file->{'symbolic names'}->{$branch}; | |||||||||||||||||||||||||||
| 431 | 0 | $rev_base =~ s/\.0//; | |||||||||||||||||||||||||||
| 432 | 0 | ▶ | while (my ($rev_name, $rev) = each %{$file->{description}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 433 | # print "$filename $rev_name\n"; | ||||||||||||||||||||||||||||
| 434 | 0 | ▶ | next if ($rev_name !~ /$rev_base/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 435 | 0 | my $message = $rev->{message}; | |||||||||||||||||||||||||||
| 436 | 0 | ▶ | $message .= q{ } . $rev->{date} if ($message eq 'no message'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 437 | 0 | my @tags; | |||||||||||||||||||||||||||
| 438 | 0 | foreach my $tag (keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 439 | 0 | ▶ | if (cmp_rev($file->{'symbolic names'}->{$tag}, $rev_name) == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 440 | 0 | push @tags, $tag; | |||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||
| 443 | 0 | ▶ | $evol{$dir}->{$message} = [] unless (exists $evol{$dir}->{$message}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 444 | 0 | push @{$evol{$dir}->{$message}}, { | |||||||||||||||||||||||||||
| 445 | filename => $filename, | ||||||||||||||||||||||||||||
| 446 | date => $rev->{date}, | ||||||||||||||||||||||||||||
| 447 | author => $rev->{author}, | ||||||||||||||||||||||||||||
| 448 | state => $rev->{state}, | ||||||||||||||||||||||||||||
| 449 | 0 | revision => $rev_name, | |||||||||||||||||||||||||||
| 450 | tags => \@tags, | ||||||||||||||||||||||||||||
| 451 | }; | ||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||
| 454 | 0 | return \%evol; | |||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | 0 | ▶ | sub getDirBranch { | ||||||||||||||||||||||||||
|
Subroutine
getDirBranch: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 458 | 0 | my $cvs_log = shift; | |||||||||||||||||||||||||||
| 459 | 0 | my ($path, $branch) = @_; | |||||||||||||||||||||||||||
| 460 | 0 | my %evol; | |||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 463 | 0 | ▶ | next if ($path ne '.' and $filename !~ /^$path/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path ne "." and not $filename =~ /^$path/
MC/DC0%0/2
$path ne "." and not $filename =~ /^$path/
$path ne "."
not $filename =~ /^$path/
Truth table0%0/3
A and not(B)
A= $path ne "."B= not $filename =~ /^$path/
| |||||||||||||||||||||||||||||
| 464 | 0 | my $in = 0; | |||||||||||||||||||||||||||
| 465 | 0 | foreach (keys %{$file->{'symbolic names'}}) { | |||||||||||||||||||||||||||
| 466 | 0 | ▶ | $in = 1 if ($_ eq $branch); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||
| 468 | 0 | ▶ | next unless ($in); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 469 | 0 | my $dir = dirname($filename); | |||||||||||||||||||||||||||
| 470 | 0 | ▶ | $evol{$dir} = 0 unless (exists $evol{$dir}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 471 | 0 | my $rev_base = $file->{'symbolic names'}->{$branch}; | |||||||||||||||||||||||||||
| 472 | 0 | $rev_base =~ s/\.0//; | |||||||||||||||||||||||||||
| 473 | 0 | ▶ | while (my ($rev_name, $rev) = each %{$file->{description}}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 474 | # print "$filename $rev_name\n"; | ||||||||||||||||||||||||||||
| 475 | 0 | ▶ | next if ($rev_name !~ /$rev_base/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 476 | 0 | $evol{$dir} ++; | |||||||||||||||||||||||||||
| 477 | 0 | last; | |||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||
| 480 | 0 | return \%evol; | |||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | ####################################################################### | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 486 | 1 | ▶ | use CVS::Metrics::Parser; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | 1 | our $cvs_log = bless {}, 'CVS::Metrics'; | |||||||||||||||||||||||||||
| 489 | 1 | our $timestamp = 0; | |||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | 0 | ▶ | sub _insert { | ||||||||||||||||||||||||||
|
Subroutine
_insert: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 492 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 493 | 0 | my ($filename, $file) = @_; | |||||||||||||||||||||||||||
| 494 | 0 | $self->{$filename} = $file; | |||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | 0 | ▶ | sub CvsLog { | ||||||||||||||||||||||||||
|
Subroutine
CvsLog: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 498 | 0 | my %hash = @_; | |||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 0 | my $cache = '.cvs_log.pl'; | |||||||||||||||||||||||||||
| 501 | 0 | ▶ | if ($hash{use_cache} and !$hash{force}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$hash{"use_cache"} and not $hash{"force"}
MC/DC0%0/2
$hash{"use_cache"} and not $hash{"force"}
$hash{"use_cache"}
not $hash{"force"}
Truth table0%0/3
A and not(B)
A= $hash{"use_cache"}B= not $hash{"force"}
| |||||||||||||||||||||||||||||
| 502 | 0 | ▶ | if ( -e $cache) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 503 | $hash{refresh} = 24 * 60 * 60 # 1 day | ||||||||||||||||||||||||||||
| 504 | 0 | ▶ | unless ($hash{refresh}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 505 | 0 | require $cache; | |||||||||||||||||||||||||||
| 506 | return $cvs_log | ||||||||||||||||||||||||||||
| 507 | 0 | ▶ | if ($timestamp + $hash{refresh} > time()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||
| 511 | 0 | my $parser = CVS::Metrics::Parser->new(); | |||||||||||||||||||||||||||
| 512 | 0 | ▶ | if ($parser) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 513 | 0 | $cvs_log = $parser->parse($hash{stream}); | |||||||||||||||||||||||||||
| 514 | 0 | ▶ | if ($hash{use_cache}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 515 | 0 | $timestamp = time(); | |||||||||||||||||||||||||||
| 516 | 0 | ▶ | if (open my $OUT, '>', $cache) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 517 | 0 | print $OUT "package CVS::Metrics;\n"; | |||||||||||||||||||||||||||
| 518 | 0 | print $OUT "\$timestamp = $timestamp;\n"; | |||||||||||||||||||||||||||
| 519 | 0 | $Data::Dumper::Indent = 1; | |||||||||||||||||||||||||||
| 520 | 0 | ▶ | while (my ($filename, $file) = each %{$cvs_log}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 521 | 0 | print $OUT Dumper($file); | |||||||||||||||||||||||||||
| 522 | 0 | print $OUT "\$cvs_log->_insert('$filename', \$VAR1);\n"; | |||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||
| 524 | 0 | close $OUT; | |||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||
| 526 | else { | ||||||||||||||||||||||||||||
| 527 | 0 | warn "can't open $cache ($!).\n"; | |||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||
| 530 | 0 | return $cvs_log; | |||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||
| 532 | 0 | return undef; | |||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | 1 | 1; | |||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | __END__ | ||||||||||||||||||||||||||||