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