| 1 | package VCI::VCS::Hg::Repository; | ||||||||||
| 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 VCI::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | extends 'VCI::Abstract::Repository'; | |||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | sub BUILD { shift->_root_always_ends_with_slash } | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 10 | |||||||||||
| 11 | # XXX Probably need to make Repository::Web and Repository::Local. | ||||||||||
| 12 | |||||||||||
| 13 | # Mostly uses hgweb, right now. | ||||||||||
| 14 | method 'x_get' => positional ( | ||||||||||
| 15 | { isa => 'VCI::Type::Path', coerce => 1, required => 1 }, | ||||||||||
| 16 | 0 | ▶ | ) => sub { | ||||||||
|
Subroutine
x_get: not called CC=3 SCAR=24.8
| |||||||||||
| 17 | 0 | my ($self, $path) = @_; | |||||||||
| 18 | 0 | my $full_path = $self->root . $path->stringify; | |||||||||
| 19 | 0 | ▶ | if ($self->vci->debug) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | print STDERR "Getting $full_path\n"; | |||||||||
| 21 | } | ||||||||||
| 22 | 0 | my $result = $self->vci->x_ua->get($full_path); | |||||||||
| 23 | 0 | ▶ | if (!$result->is_success) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | confess("Error getting $full_path: " . $result->status_line); | |||||||||
| 25 | } | ||||||||||
| 26 | 0 | return $result->content; | |||||||||
| 27 | 1 | }; | |||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub _build_projects { | ||||||||
|
Subroutine
_build_projects: not called CC=3 SCAR=24.8
| |||||||||||
| 30 | 0 | my $self = shift; | |||||||||
| 31 | 0 | my $list = $self->x_get('?style=raw'); | |||||||||
| 32 | 0 | my @lines = split("\n", $list); | |||||||||
| 33 | # Get the root so that we can trim the directory part from project names. | ||||||||||
| 34 | 0 | my $root = $self->root; | |||||||||
| 35 | 0 | $root =~ s|^http://[^/]+||; | |||||||||
| 36 | 0 | my @projects; | |||||||||
| 37 | 0 | foreach my $dir (@lines) { | |||||||||
| 38 | 0 | ▶ | next if $dir eq ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | $dir =~ s|^\Q$root\E||; | |||||||||
| 40 | 0 | push(@projects, $self->project_class->new(name => $dir, | |||||||||
| 41 | repository => $self)); | ||||||||||
| 42 | } | ||||||||||
| 43 | 0 | return \@projects; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 47 | |||||||||||
| 48 | 1 | 1; | |||||||||