| 1 | package VCI::VCS::Bzr::Directory; | ||
| 2 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | extends 'VCI::VCS::Bzr::Committable', 'VCI::Abstract::Directory'; | |
| 5 | |||
| 6 | # XXX Currently always returns HEAD contents. | ||
| 7 | 0 | ▶ | sub _build_contents { |
|
Subroutine
_build_contents: not called CC=1 SCAR=6.9
| |||
| 8 | 0 | my $self = shift; | |
| 9 | 0 | my $root = $self->repository->root . $self->project->name; | |
| 10 | 0 | my $path = $root . "/" . $self->path->stringify; | |
| 11 | # XXX We don't support symlinks yet. | ||
| 12 | 0 | my $dir_names = $self->vci->x_do( | |
| 13 | args => ['ls', '--kind=directory', $path]); | ||
| 14 | # Remove trailing slashes from the directory names, as required | ||
| 15 | # by VCI::Type::Path. | ||
| 16 | 0 | my @dirs = map { $_ =~ s{/$}{}; $_ } split("\n", $dir_names); | |
| 17 | 0 | my $file_names = $self->vci->x_do( | |
| 18 | args => ['ls', '--kind=file', $path]); | ||
| 19 | 0 | $self->_set_contents_from_list(\@dirs, [split("\n", $file_names)], $root); | |
| 20 | 0 | return $self->{contents}; | |
| 21 | } | ||
| 22 | |||
| 23 | 1 | __PACKAGE__->meta->make_immutable; | |
| 24 | |||
| 25 | 1 | 1; | |