line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVN::Dump; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
195865
|
use strict; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
190
|
|
4
|
5
|
|
|
5
|
|
28
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
159
|
|
5
|
5
|
|
|
5
|
|
120
|
use Carp; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
701
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
3691
|
use SVN::Dump::Reader; |
|
5
|
|
|
|
|
2519
|
|
|
5
|
|
|
|
|
3371
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
32
|
|
|
32
|
1
|
88686
|
my ( $class, $args ) = @_; |
13
|
32
|
|
|
|
|
241
|
my $self = bless {}, $class; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# FIXME - croak() if incompatible options |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# we have a reader |
18
|
32
|
100
|
100
|
|
|
299
|
if ( exists $args->{fh} || exists $args->{file} ) { |
19
|
29
|
|
|
|
|
60
|
my ( $fh, $file ) = delete @{$args}{qw( fh file )}; |
|
29
|
|
|
|
|
114
|
|
20
|
29
|
100
|
|
|
|
109
|
if ( !$fh ) { |
21
|
25
|
100
|
|
|
|
1412
|
open $fh, $file or croak "Can't open $file: $!"; |
22
|
|
|
|
|
|
|
} |
23
|
28
|
|
|
|
|
247
|
$self->{reader} = SVN::Dump::Reader->new( $fh, $args ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
# we don't have a reader |
26
|
|
|
|
|
|
|
else { |
27
|
3
|
100
|
|
|
|
8
|
if( exists $args->{version} ) { |
28
|
2
|
|
|
|
|
8
|
$self->{format} = SVN::Dump::Record->new(); |
29
|
2
|
|
|
|
|
9
|
$self->{format}->set_header( |
30
|
|
|
|
|
|
|
'SVN-fs-dump-format-version' => $args->{version} ); |
31
|
|
|
|
|
|
|
} |
32
|
3
|
100
|
|
|
|
10
|
if( exists $args->{uuid} ) { |
33
|
2
|
|
|
|
|
9
|
$self->{uuid} = SVN::Dump::Record->new(); |
34
|
2
|
|
|
|
|
8
|
$self->{uuid}->set_header( 'UUID' => $args->{uuid} ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
31
|
|
|
|
|
88
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub next_record { |
42
|
527
|
|
|
527
|
1
|
7931
|
my ($self) = @_; |
43
|
527
|
|
|
|
|
619
|
my $record; |
44
|
|
|
|
|
|
|
|
45
|
527
|
|
|
|
|
1673
|
RECORD: { |
46
|
527
|
|
|
|
|
854
|
$record = $self->{reader}->read_record(); |
47
|
527
|
100
|
|
|
|
1284
|
return unless $record; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# keep the first records in the dump itself |
50
|
500
|
|
|
|
|
1396
|
my $type = $record->type(); |
51
|
500
|
100
|
|
|
|
2061
|
if ( $type =~ /\A(?:format|uuid)\z/ ) { |
52
|
56
|
|
|
|
|
140
|
$self->{$type} = $record; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
500
|
|
|
|
|
2362
|
return $record; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub version { |
60
|
4
|
|
|
4
|
1
|
58
|
my ($self) = @_; |
61
|
4
|
100
|
|
|
|
27
|
return $self->{format} |
62
|
|
|
|
|
|
|
? $self->{format}->get_header('SVN-fs-dump-format-version') |
63
|
|
|
|
|
|
|
: ''; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
*format = \&version; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub uuid { |
68
|
4
|
|
|
4
|
1
|
14
|
my ($self) = @_; |
69
|
4
|
100
|
|
|
|
28
|
return $self->{uuid} ? $self->{uuid}->get_header('UUID') : ''; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub as_string { |
73
|
1
|
|
|
1
|
1
|
4
|
return join '', map { $_[0]->{$_}->as_string() } qw( format uuid ); |
|
2
|
|
|
|
|
16
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |