line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VCS::Dir; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
710
|
use VCS::File; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
947
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $PREFIX = 'VCS'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
1
|
|
|
1
|
1
|
1079
|
my $container_classtype = shift; |
9
|
1
|
|
|
|
|
16
|
$container_classtype =~ s#^$PREFIX##; |
10
|
1
|
|
|
|
|
9
|
my ($hostname, $impl_class, $path, $query) = VCS->parse_url(@_); |
11
|
1
|
|
|
|
|
26
|
VCS->class_load($impl_class); |
12
|
1
|
|
|
|
|
4
|
my $this_class = "$impl_class$container_classtype"; |
13
|
1
|
|
|
|
|
10
|
return $this_class->new(@_); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# assumes no query string |
17
|
|
|
|
|
|
|
sub init { |
18
|
1
|
|
|
1
|
1
|
11
|
my($class, $url) = @_; |
19
|
1
|
|
|
|
|
5
|
my ($hostname, $impl_class, $path, $query) = VCS->parse_url($url); |
20
|
1
|
50
|
|
|
|
26
|
if (substr($path, -1, 1) ne '/') { |
21
|
0
|
|
|
|
|
0
|
$path .= '/'; |
22
|
0
|
|
|
|
|
0
|
$url .= '/'; |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
|
|
3
|
my $self = {}; |
25
|
1
|
|
|
|
|
4
|
$self->{HOSTNAME} = $hostname; |
26
|
1
|
|
|
|
|
3
|
$self->{IMPL_CLASS} = $impl_class; |
27
|
1
|
|
|
|
|
3
|
$self->{PATH} = $path; |
28
|
1
|
|
|
|
|
2
|
$self->{URL} = $url; |
29
|
1
|
|
|
|
|
4
|
bless $self, $class; |
30
|
1
|
|
|
|
|
5
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub url { |
34
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
35
|
0
|
|
|
|
|
0
|
$self->{URL}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
1
|
0
|
sub content { |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub path { |
42
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
43
|
0
|
|
|
|
|
0
|
$self->{PATH}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub tags { |
47
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
48
|
0
|
|
|
|
|
0
|
my $rh = {}; # result hash |
49
|
0
|
|
|
|
|
0
|
my @files = $self->recursive_read_dir(); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
0
|
my $url; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
foreach my $file (@files) { |
54
|
0
|
0
|
|
|
|
0
|
my $vcsfile = eval { VCS::File->new('vcs://'.$self->{HOSTNAME}.'/'.$self->{IMPL_CLASS}.'/'.$file) } or next; |
|
0
|
|
|
|
|
0
|
|
55
|
0
|
|
|
|
|
0
|
my $file_tag_information = $vcsfile->tags(); |
56
|
0
|
|
|
|
|
0
|
foreach my $filetag (keys(%$file_tag_information)) { |
57
|
0
|
|
|
|
|
0
|
$rh->{$filetag}->{$file} = $file_tag_information->{$filetag}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
return $rh; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub recursive_read_dir { |
67
|
7
|
|
|
7
|
0
|
19
|
my $self = shift; |
68
|
7
|
|
|
|
|
10
|
my ($dir) = @_; |
69
|
7
|
|
33
|
|
|
15
|
$dir ||= $self->path(); # let it take path if its not been |
70
|
|
|
|
|
|
|
# defined, i'm not really sure about this, |
71
|
|
|
|
|
|
|
# to be honest the whole things need an |
72
|
|
|
|
|
|
|
# an overhaul in the way it works, |
73
|
|
|
|
|
|
|
# but for now i'm just happy to get |
74
|
|
|
|
|
|
|
# my work done. - Greg |
75
|
7
|
50
|
|
|
|
24
|
$dir.='/' unless (substr($dir,-1,1) eq '/'); |
76
|
7
|
|
|
|
|
8
|
my @files; |
77
|
7
|
|
|
|
|
302
|
opendir(DIR,$dir); |
78
|
7
|
|
|
|
|
100
|
my @contents = grep { (!/^\.\.?$/) } readdir(DIR); |
|
26
|
|
|
|
|
130
|
|
79
|
7
|
|
|
|
|
13
|
@contents = grep { (!/,v$/) } @contents; # RCS files, shouldn't matter if they are RCS/*,v or just *,v |
|
12
|
|
|
|
|
75
|
|
80
|
7
|
|
|
|
|
152
|
@contents = grep { (!/^CVS$/) } @contents; |
|
12
|
|
|
|
|
33
|
|
81
|
|
|
|
|
|
|
|
82
|
7
|
|
|
|
|
125
|
closedir(DIR); |
83
|
7
|
|
|
|
|
14
|
foreach my $content (@contents) { |
84
|
12
|
100
|
|
|
|
205
|
if (-d $dir.$content) { |
85
|
6
|
|
|
|
|
31
|
push(@files,($self->recursive_read_dir($dir.$content))); |
86
|
|
|
|
|
|
|
} else { |
87
|
6
|
|
|
|
|
23
|
push(@files,$dir.$content); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
7
|
|
|
|
|
26
|
return @files; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub read_dir { |
94
|
0
|
|
|
0
|
1
|
|
my ($self, $dir) = @_; |
95
|
0
|
|
|
|
|
|
local *DIR; |
96
|
0
|
|
|
|
|
|
opendir DIR, $dir; |
97
|
0
|
|
|
|
|
|
my @d = grep { (!/^\.\.?$/) } readdir DIR; |
|
0
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
closedir DIR; |
99
|
|
|
|
|
|
|
#warn "d: @d\n"; |
100
|
0
|
|
|
|
|
|
@d; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |