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