| 1 | package VCI::VCS::Bzr::History; | ||||||||||||
| 2 | 1 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | 1 | ▶ | use XML::Simple qw(:strict); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 1 | extends 'VCI::Abstract::History'; | |||||||||||
| 7 | |||||||||||||
| 8 | 0 | ▶ | sub x_from_xml { | ||||||||||
|
Subroutine
x_from_xml: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 9 | 0 | my ($class, $xml_string, $project) = @_; | |||||||||||
| 10 | # XXX We *really* should to do this with SAX, for performance reasons. | ||||||||||||
| 11 | # Right now, though, when we're using straight parsing, XML::Parser | ||||||||||||
| 12 | # parses bzr's simple XML faster than the SAX modules do. | ||||||||||||
| 13 | 0 | local $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; | |||||||||||
| 14 | 0 | my $xs = XML::Simple->new(ForceArray => [qw(file directory log)], | |||||||||||
| 15 | KeyAttr => []); | ||||||||||||
| 16 | 0 | my $xml = $xs->xml_in($xml_string); | |||||||||||
| 17 | |||||||||||||
| 18 | 0 | my @commits; | |||||||||||
| 19 | 0 | foreach my $log (@{$xml->{log}}) { | |||||||||||
| 20 | 0 | ▶ | $log->{message} ||= ''; | ||||||||||
|
Condition0%0/2
$log->{"message"} ||= ""
MC/DC0%0/1
$log->{"message"} ||= ""
$log->{"message"}
Truth table0%0/2
A
A= $log->{"message"}
| |||||||||||||
| 21 | 0 | chomp($log->{message}); | |||||||||||
| 22 | # For some reason bzr adds a single space to the start of messages | ||||||||||||
| 23 | # in XML format. | ||||||||||||
| 24 | 0 | $log->{message} =~ s/^ //; | |||||||||||
| 25 | |||||||||||||
| 26 | my $commit = $project->commit_class->new( | ||||||||||||
| 27 | revision => $log->{revisionid}, | ||||||||||||
| 28 | revno => $log->{revno}, | ||||||||||||
| 29 | committer => $log->{committer}, | ||||||||||||
| 30 | time => $log->{timestamp}, | ||||||||||||
| 31 | message => $log->{message}, | ||||||||||||
| 32 | 0 | project => $project, | |||||||||||
| 33 | ); | ||||||||||||
| 34 | |||||||||||||
| 35 | 0 | push(@commits, $commit); | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 0 | return $class->new(commits => [reverse @commits], project => $project); | |||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 42 | |||||||||||||
| 43 | 1 | 1; | |||||||||||