line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Vcdiff; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29039
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1665
|
use Symbol; |
|
1
|
|
|
|
|
1284
|
|
|
1
|
|
|
|
|
104
|
|
6
|
1
|
|
|
1
|
|
8
|
use Carp; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
369
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.505'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
## This variable indicates which backend should be used. It should |
12
|
|
|
|
|
|
|
## be a package name such as "Vcdiff::Xdelta3". |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $backend; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
## When new backends are added, this should be updated so that |
18
|
|
|
|
|
|
|
## the new backend will be probed for. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our @known_backends = qw( |
21
|
|
|
|
|
|
|
Vcdiff::Xdelta3 |
22
|
|
|
|
|
|
|
Vcdiff::OpenVcdiff |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub diff { |
28
|
0
|
|
|
0
|
0
|
|
_load_backend(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
{ |
31
|
1
|
|
|
1
|
|
7
|
no strict "refs"; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
92
|
|
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return qualify("diff", $backend)->(@_); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub patch { |
37
|
0
|
|
|
0
|
0
|
|
_load_backend(); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
|
6
|
no strict "refs"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
141
|
|
|
0
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return qualify("patch", $backend)->(@_); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub which_backend { |
46
|
0
|
|
|
0
|
0
|
|
_load_backend(); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return $backend; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _load_backend { |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
## If a backend is set, make sure it's loaded or die trying: |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
0
|
|
|
if (defined $backend) { |
56
|
0
|
|
|
|
|
|
eval "require $backend"; |
57
|
0
|
0
|
|
|
|
|
croak $@ if $@; |
58
|
0
|
|
|
|
|
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
## If a backend has already been loaded but not set, set it: |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
foreach my $backend_candidate (@known_backends) { |
64
|
1
|
|
|
1
|
|
5
|
no strict "refs"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
168
|
|
65
|
0
|
|
|
|
|
|
my $ver = ${qualify("VERSION", $backend_candidate)}; |
|
0
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if (${ qualify("VERSION", $backend_candidate) }) { |
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
eval "require $backend_candidate"; |
68
|
0
|
0
|
|
|
|
|
next if $@; |
69
|
0
|
|
|
|
|
|
$backend = $backend_candidate; |
70
|
0
|
|
|
|
|
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
## Try to find a suitable backend then load and set it: |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
foreach my $backend_candidate (@known_backends) { |
77
|
0
|
|
|
|
|
|
eval "require $backend_candidate"; |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
if (!$@) { |
80
|
0
|
|
|
|
|
|
$backend = $backend_candidate; |
81
|
0
|
|
|
|
|
|
return; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
croak "Unable to find any Vcdiff backend modules (see perldoc Vcdiff)"; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |