line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVN::Dump::Headers; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
26971
|
use strict; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
480
|
|
4
|
13
|
|
|
13
|
|
70
|
use warnings; |
|
13
|
|
|
|
|
62
|
|
|
13
|
|
|
|
|
360
|
|
5
|
13
|
|
|
13
|
|
101
|
use Carp; |
|
13
|
|
|
|
|
23
|
|
|
13
|
|
|
|
|
794
|
|
6
|
13
|
|
|
13
|
|
227
|
use Scalar::Util qw( reftype ); |
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
8980
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my $NL = "\012"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
697
|
|
|
697
|
1
|
5299
|
my ( $class, $headers ) = @_; |
12
|
697
|
100
|
66
|
|
|
2475
|
croak 'First parameter must be a HASH reference' |
|
|
|
100
|
|
|
|
|
13
|
|
|
|
|
|
|
if defined $headers |
14
|
|
|
|
|
|
|
&& !( ref $headers && reftype $headers eq 'HASH' ); |
15
|
694
|
|
|
|
|
1748
|
my $self = bless {}, $class; |
16
|
694
|
100
|
|
|
|
991
|
$self->set( $_ => $headers->{$_} ) for keys %{ $headers || {} }; |
|
694
|
|
|
|
|
4744
|
|
17
|
694
|
|
|
|
|
10658
|
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
|
849
|
|
|
849
|
1
|
1142
|
my ($self) = @_; |
55
|
849
|
|
|
|
|
1339
|
my $string = ''; |
56
|
|
|
|
|
|
|
|
57
|
849
|
|
|
|
|
938
|
for my $k ( @{ $headers{ $self->type() } } ) { |
|
849
|
|
|
|
|
2783
|
|
58
|
7261
|
100
|
|
|
|
34599
|
$string .= "$k: $self->{$k}$NL" |
59
|
|
|
|
|
|
|
if exists $self->{$k}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
849
|
|
|
|
|
3720
|
return $string . $NL; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub type { |
66
|
2206
|
|
|
2206
|
1
|
5716
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
2206
|
100
|
|
|
|
8908
|
my $type = |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
69
|
|
|
|
|
|
|
exists $self->{'Node-path'} ? 'node' |
70
|
|
|
|
|
|
|
: exists $self->{'Revision-number'} ? 'revision' |
71
|
|
|
|
|
|
|
: exists $self->{'UUID'} ? 'uuid' |
72
|
|
|
|
|
|
|
: exists $self->{'SVN-fs-dump-format-version'} ? 'format' |
73
|
|
|
|
|
|
|
: croak 'Unable to determine the record type'; |
74
|
|
|
|
|
|
|
|
75
|
2203
|
|
|
|
|
6829
|
return $type; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub set { |
79
|
120
|
|
|
120
|
1
|
2307
|
my ($self, $h, $v) = @_; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# FIXME shall we check that the header value is valid? |
82
|
120
|
|
|
|
|
178
|
$h =~ tr/_/-/; # allow _ for - simplification |
83
|
120
|
|
|
|
|
391
|
return $self->{$h} = $v; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub get { |
87
|
186
|
|
|
186
|
1
|
2323
|
my ($self, $h) = @_; |
88
|
186
|
|
|
|
|
1463
|
$h =~ tr/_/-/; # allow _ for - simplification |
89
|
186
|
|
|
|
|
544
|
return $self->{$h}; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub keys { |
93
|
6
|
|
|
6
|
1
|
1096
|
my ($self) = @_; |
94
|
6
|
|
|
|
|
9
|
return grep { exists $self->{$_} } @{ $headers{$self->type()} }; |
|
12
|
|
|
|
|
41
|
|
|
6
|
|
|
|
|
16
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |