1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
package VCS::Rcs::File;
@ISA = qw(VCS::Rcs VCS::File);
use File::Basename;
sub new {
my ($class, $url) = @_;
my $self = $class->init($url);
my $path = $self->path;
die "$class->new: $path: $!\n" unless -f $path;
die "$class->new: $path not in an RCS directory: $!\n"
unless -d dirname($path) . '/RCS' or -f "$path,v";
die "$class->new: $path failed to split log\n"
unless $self->_split_log;
$self;
}
# evil assumption - no query strings on URL!
sub versions {
my($self, $lastflag) = @_;
my @rq_version = @_;
my ($header, @log_revs) = $self->_split_log;
my $header_info = $self->_parse_log_header($header);
my $last_rev = $header_info->{'head'};
#warn "last_rev: $last_rev\n";
my ($rev_head, $rev_tail) = ($last_rev =~ /(.*)\.(\d+)$/);
return VCS::Rcs::Version->new("$self->{URL}/$rev_head.$rev_tail")
if defined $lastflag;
map {
VCS::Rcs::Version->new("$self->{URL}/$rev_head.$_")
} (1..$rev_tail);
}
sub tags {
my $self = shift;
my ($header, $log) = $self->_split_log($self->{VERSION});
my $header_info = $self->_parse_log_header($header);
my $tags_hash = {};
my $tag_text = $header_info->{'symbolic names'};
$tag_text =~ s#^\s+##gm;
map {
my ($tag, $rev) = split /:\s*/;
$tags_hash->{$tag} = $rev;
} split /\n/, $tag_text;
return $tags_hash;
}
1;
|