| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PatchReader::DiffPrinter::template; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
869
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
791
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
|
6
|
1
|
|
|
1
|
0
|
408
|
my $class = shift; |
|
7
|
1
|
|
33
|
|
|
6
|
$class = ref($class) || $class; |
|
8
|
1
|
|
|
|
|
2
|
my $this = {}; |
|
9
|
1
|
|
|
|
|
2
|
bless $this, $class; |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
4
|
$this->{TEMPLATE_PROCESSOR} = $_[0]; |
|
12
|
1
|
|
|
|
|
2
|
$this->{HEADER_TEMPLATE} = $_[1]; |
|
13
|
1
|
|
|
|
|
1
|
$this->{FILE_TEMPLATE} = $_[2]; |
|
14
|
1
|
|
|
|
|
1
|
$this->{FOOTER_TEMPLATE} = $_[3]; |
|
15
|
1
|
|
50
|
|
|
5
|
$this->{ARGS} = $_[4] || {}; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
3
|
return $this; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub start_patch { |
|
21
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
|
22
|
0
|
0
|
|
|
|
|
$this->{TEMPLATE_PROCESSOR}->process($this->{HEADER_TEMPLATE}, $this->{ARGS}) |
|
23
|
|
|
|
|
|
|
|| ::ThrowTemplateError($this->{TEMPLATE_PROCESSOR}->error()); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub end_patch { |
|
27
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
|
28
|
0
|
0
|
|
|
|
|
$this->{TEMPLATE_PROCESSOR}->process($this->{FOOTER_TEMPLATE}, $this->{ARGS}) |
|
29
|
|
|
|
|
|
|
|| ::ThrowTemplateError($this->{TEMPLATE_PROCESSOR}->error()); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub start_file { |
|
33
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
|
34
|
0
|
|
|
|
|
|
$this->{ARGS}{file} = shift; |
|
35
|
0
|
|
|
|
|
|
$this->{ARGS}{file}{plus_lines} = 0; |
|
36
|
0
|
|
|
|
|
|
$this->{ARGS}{file}{minus_lines} = 0; |
|
37
|
0
|
|
|
|
|
|
@{$this->{ARGS}{sections}} = (); |
|
|
0
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub end_file { |
|
41
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
|
42
|
0
|
|
|
|
|
|
my $file = $this->{ARGS}{file}; |
|
43
|
0
|
0
|
0
|
|
|
|
if ($file->{canonical} && $file->{old_revision} && $this->{ARGS}{bonsai_url}) { |
|
|
|
|
0
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$this->{ARGS}{bonsai_prefix} = "$this->{ARGS}{bonsai_url}/cvsblame.cgi?file=$file->{filename}&rev=$file->{old_revision}"; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
0
|
0
|
0
|
|
|
|
if ($file->{canonical} && $this->{ARGS}{lxr_url}) { |
|
47
|
|
|
|
|
|
|
# Cut off the lxr root, if any |
|
48
|
0
|
|
|
|
|
|
my $filename = $file->{filename}; |
|
49
|
0
|
|
|
|
|
|
$filename = substr($filename, length($this->{ARGS}{lxr_root})); |
|
50
|
0
|
|
|
|
|
|
$this->{ARGS}{lxr_prefix} = "$this->{ARGS}{lxr_url}/source/$filename"; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
$this->{TEMPLATE_PROCESSOR}->process($this->{FILE_TEMPLATE}, $this->{ARGS}) |
|
54
|
|
|
|
|
|
|
|| ::ThrowTemplateError($this->{TEMPLATE_PROCESSOR}->error()); |
|
55
|
0
|
|
|
|
|
|
@{$this->{ARGS}{sections}} = (); |
|
|
0
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
delete $this->{ARGS}{file}; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub next_section { |
|
60
|
0
|
|
|
0
|
0
|
|
my $this = shift; |
|
61
|
0
|
|
|
|
|
|
my ($section) = @_; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$this->{ARGS}{file}{plus_lines} += $section->{plus_lines}; |
|
64
|
0
|
|
|
|
|
|
$this->{ARGS}{file}{minus_lines} += $section->{minus_lines}; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Get groups of lines and print them |
|
67
|
0
|
|
|
|
|
|
my $last_line_char = ''; |
|
68
|
0
|
|
|
|
|
|
my $context_lines = []; |
|
69
|
0
|
|
|
|
|
|
my $plus_lines = []; |
|
70
|
0
|
|
|
|
|
|
my $minus_lines = []; |
|
71
|
0
|
|
|
|
|
|
foreach my $line (@{$section->{lines}}) { |
|
|
0
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$line =~ s/\r?\n?$//; |
|
73
|
0
|
0
|
|
|
|
|
if ($line =~ /^ /) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
if ($last_line_char ne ' ') { |
|
75
|
0
|
|
|
|
|
|
push @{$section->{groups}}, {context => $context_lines, |
|
|
0
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
plus => $plus_lines, |
|
77
|
|
|
|
|
|
|
minus => $minus_lines}; |
|
78
|
0
|
|
|
|
|
|
$context_lines = []; |
|
79
|
0
|
|
|
|
|
|
$plus_lines = []; |
|
80
|
0
|
|
|
|
|
|
$minus_lines = []; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
0
|
|
|
|
|
|
$last_line_char = ' '; |
|
83
|
0
|
|
|
|
|
|
push @{$context_lines}, substr($line, 1); |
|
|
0
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} elsif ($line =~ /^\+/) { |
|
85
|
0
|
0
|
0
|
|
|
|
if ($last_line_char eq ' ' || $last_line_char eq '-' && @{$plus_lines}) { |
|
|
0
|
|
0
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
push @{$section->{groups}}, {context => $context_lines, |
|
|
0
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
plus => $plus_lines, |
|
88
|
|
|
|
|
|
|
minus => $minus_lines}; |
|
89
|
0
|
|
|
|
|
|
$context_lines = []; |
|
90
|
0
|
|
|
|
|
|
$plus_lines = []; |
|
91
|
0
|
|
|
|
|
|
$minus_lines = []; |
|
92
|
0
|
|
|
|
|
|
$last_line_char = ''; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
0
|
|
|
|
|
|
$last_line_char = '+'; |
|
95
|
0
|
|
|
|
|
|
push @{$plus_lines}, substr($line, 1); |
|
|
0
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
} elsif ($line =~ /^-/) { |
|
97
|
0
|
0
|
0
|
|
|
|
if ($last_line_char eq '+' && @{$minus_lines}) { |
|
|
0
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
push @{$section->{groups}}, {context => $context_lines, |
|
|
0
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
plus => $plus_lines, |
|
100
|
|
|
|
|
|
|
minus => $minus_lines}; |
|
101
|
0
|
|
|
|
|
|
$context_lines = []; |
|
102
|
0
|
|
|
|
|
|
$plus_lines = []; |
|
103
|
0
|
|
|
|
|
|
$minus_lines = []; |
|
104
|
0
|
|
|
|
|
|
$last_line_char = ''; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
0
|
|
|
|
|
|
$last_line_char = '-'; |
|
107
|
0
|
|
|
|
|
|
push @{$minus_lines}, substr($line, 1); |
|
|
0
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
push @{$section->{groups}}, {context => $context_lines, |
|
|
0
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
plus => $plus_lines, |
|
113
|
|
|
|
|
|
|
minus => $minus_lines}; |
|
114
|
0
|
|
|
|
|
|
push @{$this->{ARGS}{sections}}, $section; |
|
|
0
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1 |