line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVN::Dump::Headers; |
2
|
|
|
|
|
|
|
$SVN::Dump::Headers::VERSION = '0.07'; |
3
|
12
|
|
|
12
|
|
67606
|
use strict; |
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
340
|
|
4
|
12
|
|
|
12
|
|
61
|
use warnings; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
317
|
|
5
|
12
|
|
|
12
|
|
68
|
use Carp; |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
660
|
|
6
|
12
|
|
|
12
|
|
71
|
use Scalar::Util qw( reftype ); |
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
6485
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my $NL = "\012"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
711
|
|
|
711
|
1
|
5037
|
my ( $class, $headers ) = @_; |
12
|
711
|
100
|
66
|
|
|
1823
|
croak 'First parameter must be a HASH reference' |
|
|
|
100
|
|
|
|
|
13
|
|
|
|
|
|
|
if defined $headers |
14
|
|
|
|
|
|
|
&& !( ref $headers && reftype $headers eq 'HASH' ); |
15
|
708
|
|
|
|
|
1227
|
my $self = bless {}, $class; |
16
|
708
|
100
|
|
|
|
1051
|
$self->set( $_ => $headers->{$_} ) for keys %{ $headers || {} }; |
|
708
|
|
|
|
|
2969
|
|
17
|
708
|
|
|
|
|
1741
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %headers = ( |
21
|
|
|
|
|
|
|
revision => [ |
22
|
|
|
|
|
|
|
qw( |
23
|
|
|
|
|
|
|
Revision-number |
24
|
|
|
|
|
|
|
Prop-content-length |
25
|
|
|
|
|
|
|
Content-length |
26
|
|
|
|
|
|
|
) |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
], |
29
|
|
|
|
|
|
|
node => [ |
30
|
|
|
|
|
|
|
qw( |
31
|
|
|
|
|
|
|
Node-path |
32
|
|
|
|
|
|
|
Node-kind |
33
|
|
|
|
|
|
|
Node-action |
34
|
|
|
|
|
|
|
Node-copyfrom-rev |
35
|
|
|
|
|
|
|
Node-copyfrom-path |
36
|
|
|
|
|
|
|
Prop-delta |
37
|
|
|
|
|
|
|
Prop-content-length |
38
|
|
|
|
|
|
|
Text-copy-source-md5 |
39
|
|
|
|
|
|
|
Text-copy-source-sha1 |
40
|
|
|
|
|
|
|
Text-delta |
41
|
|
|
|
|
|
|
Text-content-length |
42
|
|
|
|
|
|
|
Text-content-md5 |
43
|
|
|
|
|
|
|
Text-content-sha1 |
44
|
|
|
|
|
|
|
Content-length |
45
|
|
|
|
|
|
|
) |
46
|
|
|
|
|
|
|
], |
47
|
|
|
|
|
|
|
uuid => ['UUID'], |
48
|
|
|
|
|
|
|
format => ['SVN-fs-dump-format-version'], |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# FIXME Prop-delta and Text-delta in version 3 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub as_string { |
54
|
863
|
|
|
863
|
1
|
1324
|
my ($self) = @_; |
55
|
863
|
|
|
|
|
1153
|
my $string = ''; |
56
|
|
|
|
|
|
|
|
57
|
863
|
|
|
|
|
1092
|
for my $k ( @{ $headers{ $self->type() } } ) { |
|
863
|
|
|
|
|
1325
|
|
58
|
|
|
|
|
|
|
$string .= "$k: $self->{$k}$NL" |
59
|
7376
|
100
|
|
|
|
15262
|
if exists $self->{$k}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
863
|
|
|
|
|
2223
|
return $string . $NL; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub type { |
66
|
2248
|
|
|
2248
|
1
|
3557
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $type = |
69
|
|
|
|
|
|
|
exists $self->{'Node-path'} ? 'node' |
70
|
|
|
|
|
|
|
: exists $self->{'Revision-number'} ? 'revision' |
71
|
|
|
|
|
|
|
: exists $self->{'UUID'} ? 'uuid' |
72
|
2248
|
100
|
|
|
|
4643
|
: exists $self->{'SVN-fs-dump-format-version'} ? 'format' |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
73
|
|
|
|
|
|
|
: croak 'Unable to determine the record type'; |
74
|
|
|
|
|
|
|
|
75
|
2245
|
|
|
|
|
4844
|
return $type; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub set { |
79
|
120
|
|
|
120
|
1
|
2383
|
my ($self, $h, $v) = @_; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# FIXME shall we check that the header value is valid? |
82
|
120
|
|
|
|
|
192
|
$h =~ tr/_/-/; # allow _ for - simplification |
83
|
120
|
|
|
|
|
289
|
return $self->{$h} = $v; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub get { |
87
|
186
|
|
|
186
|
1
|
2500
|
my ($self, $h) = @_; |
88
|
186
|
|
|
|
|
305
|
$h =~ tr/_/-/; # allow _ for - simplification |
89
|
186
|
|
|
|
|
442
|
return $self->{$h}; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub keys { |
93
|
6
|
|
|
6
|
1
|
1078
|
my ($self) = @_; |
94
|
6
|
|
|
|
|
11
|
return grep { exists $self->{$_} } @{ $headers{$self->type()} }; |
|
12
|
|
|
|
|
37
|
|
|
6
|
|
|
|
|
15
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |