line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VCS::Vss;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19143
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
653
|
|
4
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
549
|
use VCS::Vss::Dir;
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use VCS::Vss::File;
|
7
|
|
|
|
|
|
|
use VCS::Vss::Version;
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '0.20';
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $vss;
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _open_vss_db {
|
14
|
|
|
|
|
|
|
my($self) = @_;
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $vss = new Win32::OLE("SourceSafe.0");
|
17
|
|
|
|
|
|
|
my $srcsafe_ini = $self->srcsafe_ini();
|
18
|
|
|
|
|
|
|
$srcsafe_ini =~ s|/|\\|g;
|
19
|
|
|
|
|
|
|
$vss->Open($srcsafe_ini);
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
if (!$vss->{SrcSafeIni}) {
|
22
|
|
|
|
|
|
|
die "Couldn't open VSS database at: " . $self->srcsafe_ini() . "\n" . Win32::OLE::LastError;
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->{vss} = $vss;
|
26
|
|
|
|
|
|
|
return 1;
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _vss_conn {
|
30
|
|
|
|
|
|
|
my($self) = @_;
|
31
|
|
|
|
|
|
|
unless($self->{vss}) {
|
32
|
|
|
|
|
|
|
$self->_open_vss_db();
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
$vss = $self->{vss};
|
35
|
|
|
|
|
|
|
return $self->{vss};
|
36
|
|
|
|
|
|
|
}
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _fix_path {
|
39
|
|
|
|
|
|
|
my ($self) = @_;
|
40
|
|
|
|
|
|
|
my $new_path;
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Remove ignored query portion of path
|
43
|
|
|
|
|
|
|
$self->{PATH} =~ s/\?.+//;
|
44
|
|
|
|
|
|
|
$self->{URL} =~ s/\?.+//;
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Patch provided by Tim Hood to handle spaces in URLs (taken from CGI unescape function)
|
47
|
|
|
|
|
|
|
$self->{PATH} =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
($self->{SRCSAFE_INI}, $new_path) = $self->{PATH} =~ m|^/(.+)srcsafe.ini/(.+)|;
|
50
|
|
|
|
|
|
|
if ($self->{SRCSAFE_INI}) {
|
51
|
|
|
|
|
|
|
$self->{PATH} = '$/' . $new_path;
|
52
|
|
|
|
|
|
|
$self->{SRCSAFE_INI} .= 'srcsafe.ini';
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
else {
|
55
|
|
|
|
|
|
|
$self->{PATH} =~ s|^/||;
|
56
|
|
|
|
|
|
|
$self->{PATH} = '$/' . $self->{PATH};
|
57
|
|
|
|
|
|
|
$self->{SRCSAFE_INI} = $ENV{VSSROOT} . "/srcsafe.ini";
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
die ref($self) . "->new: " . $self->srcsafe_ini . " not a VSS ini file: $!"
|
60
|
|
|
|
|
|
|
unless -f $self->srcsafe_ini;
|
61
|
|
|
|
|
|
|
return 1;
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _get_vss_item {
|
65
|
|
|
|
|
|
|
my ($self) = @_;
|
66
|
|
|
|
|
|
|
my $vss_item = $self->_vss_conn->VSSItem($self->path);
|
67
|
|
|
|
|
|
|
if (!$vss_item) {
|
68
|
|
|
|
|
|
|
die ref($self) . "->new: " . $self->path . " is not a valid VSS path for this database";
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
return $vss_item;
|
71
|
|
|
|
|
|
|
}
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub vss_object {
|
74
|
|
|
|
|
|
|
my ($self) = @_;
|
75
|
|
|
|
|
|
|
if (ref($self) eq 'VCS::Vss') {
|
76
|
|
|
|
|
|
|
return $self->_vss_conn();
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
return $self->{vss_object} if $self->{vss_object};
|
79
|
|
|
|
|
|
|
$self->{vss_object} = $self->_get_vss_item($self->path);
|
80
|
|
|
|
|
|
|
return $self->{vss_object};
|
81
|
|
|
|
|
|
|
}
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub cleanup {
|
84
|
|
|
|
|
|
|
$vss->Quit() if $vss;
|
85
|
|
|
|
|
|
|
}
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub srcsafe_ini {
|
88
|
|
|
|
|
|
|
my ($self) = @_;
|
89
|
|
|
|
|
|
|
return $self->{SRCSAFE_INI};
|
90
|
|
|
|
|
|
|
}
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1;
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__
|