| 1 | package VCI::VCS::Hg::Directory; | ||||||||||
| 2 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | extends 'VCI::Abstract::Directory'; | |||||||||
| 5 | 1 | with 'VCI::VCS::Hg::Committable'; | |||||||||
| 6 | |||||||||||
| 7 | 0 | ▶ | sub _build_revision { return 'tip' } | ||||||||
|
Subroutine
_build_revision: not called CC=1 SCAR=6.9
| |||||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | sub _build_contents { | ||||||||
|
Subroutine
_build_contents: not called CC=4 SCAR=30.0
| |||||||||||
| 10 | 0 | my $self = shift; | |||||||||
| 11 | 0 | my $ls = $self->project->x_get(['raw-file/', $self->revision, $self->path]); | |||||||||
| 12 | 0 | my @lines = split("\n", $ls); | |||||||||
| 13 | 0 | my @dir_lines = grep(/^d/, @lines); | |||||||||
| 14 | 0 | my @file_lines = grep(/^-/, @lines); | |||||||||
| 15 | |||||||||||
| 16 | 0 | my @contents; | |||||||||
| 17 | 0 | foreach my $dir_line (@dir_lines) { | |||||||||
| 18 | 0 | $dir_line =~ /^\S+ (.*)$/; | |||||||||
| 19 | 0 | push(@contents, $self->directory_class->new(path => [$self->path, $1], | |||||||||
| 20 | project => $self->project, | ||||||||||
| 21 | revision => $self->revision, | ||||||||||
| 22 | parent => $self)); | ||||||||||
| 23 | } | ||||||||||
| 24 | 0 | foreach my $file_line (@file_lines) { | |||||||||
| 25 | 0 | $file_line =~ /^(\S+) (\d+) (.*)$/; | |||||||||
| 26 | 0 | my ($properties, $size, $name) = ($1, $2, $3); | |||||||||
| 27 | 0 | my $executable = 0; | |||||||||
| 28 | 0 | ▶ | $executable = 1 if $properties =~ /x/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | push(@contents, $self->file_class->new(path => [$self->path, $name], | |||||||||
| 30 | is_executable => $executable, | ||||||||||
| 31 | content_size => $size, | ||||||||||
| 32 | project => $self->project, | ||||||||||
| 33 | parent => $self)); | ||||||||||
| 34 | } | ||||||||||
| 35 | 0 | return \@contents; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||