| 1 | package VCI::VCS::Hg::Project; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use MooseX::Method; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use XML::Simple qw(:strict); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use VCI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | extends 'VCI::Abstract::Project'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 13 | 0 | $self->_name_never_ends_with_slash(); | |||||||||||||||||||||||||||
| 14 | 0 | $self->_name_never_starts_with_slash(); | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | method 'get_file' => named ( | ||||||||||||||||||||||||||||
| 18 | path => { isa => 'VCI::Type::Path', coerce => 1, required => 1 }, | ||||||||||||||||||||||||||||
| 19 | revision => { isa => 'Str' }, | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | ) => sub { | ||||||||||||||||||||||||||
|
Subroutine
get_file: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 21 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 22 | 0 | my ($params) = @_; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if (defined $params->{revision} && $params->{revision} eq 'tip') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $params->{"revision"} and $params->{"revision"} eq "tip"
MC/DC0%0/2
defined $params->{"revision"} and $params->{"revision"} eq "tip"
defined $params->{"revision"}
$params->{"revision"} eq "tip"
Truth table0%0/3
A and B
A= defined $params->{"revision"}B= $params->{"revision"} eq "tip"
| |||||||||||||||||||||||||||||
| 25 | 0 | $params->{revision} = $self->head_revision; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # MooseX::Method always has a hash key for each parameter, even if they | ||||||||||||||||||||||||||||
| 29 | # weren't passed by the caller. | ||||||||||||||||||||||||||||
| 30 | 0 | delete $params->{$_} foreach (grep(!defined $params->{$_}, keys %$params)); | |||||||||||||||||||||||||||
| 31 | 0 | return $self->SUPER::get_file(@_); | |||||||||||||||||||||||||||
| 32 | 1 | }; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub x_get { | ||||||||||||||||||||||||||
|
Subroutine
x_get: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | my ($self, $path) = @_; | |||||||||||||||||||||||||||
| 36 | 0 | ▶ | my @path = ref $path eq 'ARRAY' ? @$path : $path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | return $self->repository->x_get([$self->name, @path]); | |||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # Currently, we just get the first items listed in the changelog, and | ||||||||||||||||||||||||||||
| 41 | # just assume that changesets exist from this one back to #1. The | ||||||||||||||||||||||||||||
| 42 | # changesets themselves can easily modify themselves. | ||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub _build_history { | ||||||||||||||||||||||||||
|
Subroutine
_build_history: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 44 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 45 | 0 | return $self->history_class->x_from_rss('', $self); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub _build_head_revision { | ||||||||||||||||||||||||||
|
Subroutine
_build_head_revision: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | if (exists $self->{history}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | my $last_commit = $self->history->commits->[-1]; | |||||||||||||||||||||||||||
| 52 | 0 | ▶ | return defined $last_commit ? $last_commit->revision : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | my $raw_rev = $self->x_get('raw-rev'); | |||||||||||||||||||||||||||
| 56 | 0 | ▶ | $raw_rev =~ /^# Node ID (\S+)$/ms || return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | return substr($1, 0, 12); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | 1; | |||||||||||||||||||||||||||