| 1 | package VCI::VCS::Cvs::File; | ||||||||||
| 2 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | extends 'VCI::Abstract::File'; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use constant CHECKOUT_HEADER => '=+\n.+?\nRCS:\s+.+?,v\nVERS: [\.\d]+\n\*+\n'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | # XXX If we have a History, these two should probably just use latest_revision. | ||||||||||
| 9 | |||||||||||
| 10 | 0 | ▶ | sub _build_revision { | ||||||||
|
Subroutine
_build_revision: not called CC=1 SCAR=6.9
| |||||||||||
| 11 | 0 | my $self = shift; | |||||||||
| 12 | 0 | my $output = $self->vci->x_do( | |||||||||
| 13 | args => ['-n', 'status', $self->name], | ||||||||||
| 14 | fromdir => $self->parent->x_cvs_dir); | ||||||||||
| 15 | 0 | $output =~ /^\s+Repository revision:\s([\d\.]+)/ms; | |||||||||
| 16 | 0 | return $1; | |||||||||
| 17 | } | ||||||||||
| 18 | 0 | ▶ | sub _build_revno { shift->revision } | ||||||||
|
Subroutine
_build_revno: not called CC=1 SCAR=6.9
| |||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub _build_time { | ||||||||
|
Subroutine
_build_time: not called CC=2 SCAR=17.9
| |||||||||||
| 21 | 0 | my $self = shift; | |||||||||
| 22 | 0 | my $rev = $self->revision; | |||||||||
| 23 | # CVS 1.12 includes timezones in timestamps, and outputs them | ||||||||||
| 24 | # in the timezone specified by the TZ environment variable. | ||||||||||
| 25 | 0 | local $ENV{TZ} = 'UTC'; | |||||||||
| 26 | 0 | my $output = $self->vci->x_do( | |||||||||
| 27 | args => ['-n', 'log', '-N', "-r$rev", $self->name], | ||||||||||
| 28 | fromdir => $self->parent->x_cvs_dir); | ||||||||||
| 29 | 0 | $output =~ /^date: (\S+ \S+(?: \S+)?);/ms; | |||||||||
| 30 | 0 | my $time = $1; | |||||||||
| 31 | 0 | ▶ | confess("Failed to parse time for " . $self->path->stringify . " $rev") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | if !defined $time; | ||||||||||
| 33 | 0 | return "$time UTC"; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub _build_content { | ||||||||
|
Subroutine
_build_content: not called CC=2 SCAR=17.9
| |||||||||||
| 37 | 0 | my $self = shift; | |||||||||
| 38 | 0 | my $rev = $self->revision; | |||||||||
| 39 | 0 | my $output = $self->vci->x_do( | |||||||||
| 40 | args => ['update', '-p', "-r$rev", $self->name], | ||||||||||
| 41 | fromdir => $self->parent->x_cvs_dir); | ||||||||||
| 42 | # CVS puts a header at the top of each file it checks out, when using | ||||||||||
| 43 | # the -p argument. Sometimes (randomly) the header shows up at the bottom. | ||||||||||
| 44 | 0 | my $header = CHECKOUT_HEADER; | |||||||||
| 45 | 0 | ▶ | $output =~ s/^$header//s || $output =~ s/$header$//s; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | return $output; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||