line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SmokeRunner::Multi::TestSet::SVN; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
8
|
|
|
8
|
|
325
|
$SmokeRunner::Multi::TestSet::SVN::AUTHORITY = 'cpan:YANICK'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$SmokeRunner::Multi::TestSet::SVN::VERSION = '0.19'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
#ABSTRACT: Represents a set of test based on an SVN checkout |
9
|
|
|
|
|
|
|
|
10
|
8
|
|
|
8
|
|
42
|
use strict; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
252
|
|
11
|
8
|
|
|
8
|
|
39
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
235
|
|
12
|
|
|
|
|
|
|
|
13
|
8
|
|
|
8
|
|
55
|
use base 'SmokeRunner::Multi::TestSet'; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
916
|
|
14
|
|
|
|
|
|
|
|
15
|
8
|
|
|
8
|
|
9180
|
use DateTime::Format::Strptime; |
|
8
|
|
|
|
|
1449892
|
|
|
8
|
|
|
|
|
596
|
|
16
|
8
|
|
|
8
|
|
129
|
use File::Spec; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
179
|
|
17
|
8
|
|
|
8
|
|
42
|
use File::Which; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
492
|
|
18
|
8
|
|
|
8
|
|
3558
|
use SmokeRunner::Multi::SafeRun qw( safe_run ); |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
4086
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _new |
22
|
|
|
|
|
|
|
{ |
23
|
47
|
|
|
47
|
|
124
|
my $class = shift; |
24
|
47
|
|
|
|
|
219
|
my %p = @_; |
25
|
|
|
|
|
|
|
|
26
|
47
|
100
|
|
|
|
2410
|
return unless -d File::Spec->catdir( $p{set_dir}, '.svn' ); |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
49
|
return bless \%p, $class; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _last_mod_time |
32
|
|
|
|
|
|
|
{ |
33
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
8
|
my $uri = $self->_svn_uri(); |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
9
|
my $output = $self->_run_svn( 'info', $uri ); |
38
|
|
|
|
|
|
|
|
39
|
2
|
50
|
|
|
|
20
|
die "Cannot get last_mod_time for SVN set in " . $self->set_dir() |
40
|
|
|
|
|
|
|
unless $output =~ /^Last Changed Date: (\S+) (\S+) (\S+)/m; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
10
|
my ( $date, $time, $tz ) = ( $1, $2, $3 ); |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
19
|
my $parser = |
45
|
|
|
|
|
|
|
DateTime::Format::Strptime->new |
46
|
|
|
|
|
|
|
( pattern => '%F %T', |
47
|
|
|
|
|
|
|
time_zone => $tz, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
1914
|
return $parser->parse_datetime("$date $time")->epoch; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _svn_uri |
54
|
|
|
|
|
|
|
{ |
55
|
3
|
|
|
3
|
|
9
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
3
|
100
|
|
|
|
14
|
return $self->{svn_uri} if $self->{svn_uri}; |
58
|
|
|
|
|
|
|
|
59
|
2
|
|
|
|
|
15
|
my $output = $self->_run_svn( 'info', $self->set_dir() ); |
60
|
|
|
|
|
|
|
|
61
|
2
|
50
|
|
|
|
36
|
die "Cannot determine svn URI\n" |
62
|
|
|
|
|
|
|
unless $output =~ /^URL: (\S+)/m; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
15
|
return $self->{svn_uri} = $1; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub update_files |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
$self->_run_svn( 'up', $self->set_dir() ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _run_svn |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
0
|
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $stdout; |
79
|
|
|
|
|
|
|
my $stderr; |
80
|
0
|
|
|
|
|
|
safe_run( command => 'svn', |
81
|
|
|
|
|
|
|
args => [@_], |
82
|
|
|
|
|
|
|
stdout_buffer => \$stdout, |
83
|
|
|
|
|
|
|
stderr_buffer => \$stderr, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
die "Error running svn:\n$stderr\n" |
87
|
|
|
|
|
|
|
if $stderr; |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return $stdout; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |