| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Git::FastExport; |
|
2
|
|
|
|
|
|
|
$Git::FastExport::VERSION = '0.108'; |
|
3
|
4
|
|
|
4
|
|
134462
|
use strict; |
|
|
4
|
|
|
|
|
24
|
|
|
|
4
|
|
|
|
|
118
|
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
94
|
|
|
5
|
4
|
|
|
4
|
|
19
|
use Carp; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
231
|
|
|
6
|
4
|
|
|
4
|
|
26
|
use Scalar::Util qw( blessed ); |
|
|
4
|
|
|
|
|
15
|
|
|
|
4
|
|
|
|
|
194
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1114
|
use Git::Repository; |
|
|
4
|
|
|
|
|
90120
|
|
|
|
4
|
|
|
|
|
20
|
|
|
9
|
4
|
|
|
4
|
|
1896
|
use Git::FastExport::Block; |
|
|
4
|
|
|
|
|
17
|
|
|
|
4
|
|
|
|
|
2929
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $LF = "\012"; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
66
|
|
|
66
|
1
|
2451
|
my ( $class, $handle ) = @_; |
|
15
|
66
|
|
|
|
|
1032
|
return bless { stream => $handle }, $class; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub next_block { |
|
19
|
806
|
|
|
806
|
1
|
14532
|
my ($self) = @_; |
|
20
|
806
|
|
|
|
|
1468
|
my $fh = $self->{stream}; |
|
21
|
806
|
100
|
|
|
|
2130
|
return if !defined $fh; |
|
22
|
|
|
|
|
|
|
|
|
23
|
805
|
|
|
|
|
2668
|
my $block = bless {}, 'Git::FastExport::Block'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# pick up the header from the previous round, or read it (first time) |
|
26
|
805
|
|
100
|
|
|
124194
|
$self->{header} ||= <$fh>; |
|
27
|
805
|
|
|
|
|
2487
|
$block->{header} = delete $self->{header}; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# nothing left to process |
|
30
|
805
|
100
|
|
|
|
2078
|
return if !defined $block->{header}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
741
|
|
|
|
|
1507
|
chomp $block->{header}; |
|
33
|
741
|
|
|
|
|
5575
|
( $block->{type} ) = $block->{header} =~ /^(\w+)/g; |
|
34
|
|
|
|
|
|
|
|
|
35
|
741
|
|
|
|
|
1509
|
local $_; |
|
36
|
741
|
|
|
|
|
3602
|
while (<$fh>) { |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# we've reached the beginning of the next block |
|
39
|
2472
|
100
|
|
|
|
7371
|
if (/^(commit|tag|reset|blob|checkpoint|progress|feature|option|done)\b/) { |
|
40
|
678
|
50
|
|
|
|
1786
|
s/^progress /progress [$self->{source}] / if exists $self->{source}; |
|
41
|
678
|
|
|
|
|
1319
|
$self->{header} = $_; |
|
42
|
678
|
|
|
|
|
1233
|
last; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
1794
|
|
|
|
|
2552
|
chomp; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# special case of data block |
|
48
|
1794
|
100
|
|
|
|
6127
|
if (/^data (.*)/) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
49
|
286
|
50
|
|
|
|
846
|
if ( substr( $1, 0, 2 ) eq '<<' ) { # Delimited format |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# 'data' SP '<<' LF |
|
52
|
|
|
|
|
|
|
# LF |
|
53
|
|
|
|
|
|
|
# LF |
|
54
|
|
|
|
|
|
|
# LF? |
|
55
|
0
|
|
|
|
|
0
|
my $delim = substr( $1, 2 ); |
|
56
|
0
|
|
|
|
|
0
|
local $/ = "$LF$delim$LF"; |
|
57
|
0
|
|
|
|
|
0
|
chomp( $block->{data} = <$fh> ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
else { # Exact byte count format |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# 'data' SP LF |
|
62
|
|
|
|
|
|
|
# LF? |
|
63
|
286
|
|
|
|
|
533
|
my $bytes = $1; |
|
64
|
286
|
50
|
|
|
|
474
|
if ($bytes) { |
|
65
|
286
|
|
|
|
|
1168
|
local $/ = \$bytes; |
|
66
|
286
|
|
|
|
|
1467
|
$block->{data} = <$fh>; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
else { |
|
69
|
0
|
|
|
|
|
0
|
$block->{data} = ""; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
elsif (/^(?:[MDRC] |deleteall)/) { |
|
74
|
8
|
|
|
|
|
12
|
push @{ $block->{files} }, $_; |
|
|
8
|
|
|
|
|
43
|
|
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
elsif (/^(\w+)/) { |
|
77
|
1151
|
|
|
|
|
1600
|
push @{ $block->{$1} }, $_; |
|
|
1151
|
|
|
|
|
5673
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
else { |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# ignore empty lines, but choke on others |
|
82
|
349
|
50
|
|
|
|
983
|
die "Unexpected line:\n$_\n" if !/^$/; |
|
83
|
349
|
|
|
|
|
1459
|
$block->{footer} .= "\012"; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# post-processing |
|
88
|
741
|
100
|
|
|
|
1743
|
if ( $block->{type} eq 'commit' ) { |
|
89
|
|
|
|
|
|
|
( $block->{committer_date} ) |
|
90
|
272
|
|
|
|
|
1420
|
= $block->{committer}[0] =~ /^committer [^>]*> (\d+) [-+]\d+$/g; |
|
91
|
|
|
|
|
|
|
( $block->{author_date} ) |
|
92
|
272
|
|
|
|
|
1082
|
= $block->{author}[0] =~ /^author [^>]*> (\d+) [-+]\d+$/g; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
741
|
|
|
|
|
2438
|
return $block; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
'progress 1 objects'; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |