line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Raw::Packbuilder; |
2
|
|
|
|
|
|
|
$Git::Raw::Packbuilder::VERSION = '0.90'; |
3
|
36
|
|
|
44
|
|
218
|
use strict; |
|
36
|
|
|
|
|
64
|
|
|
36
|
|
|
|
|
950
|
|
4
|
36
|
|
|
36
|
|
164
|
use warnings; |
|
36
|
|
|
|
|
62
|
|
|
36
|
|
|
|
|
772
|
|
5
|
36
|
|
|
36
|
|
156
|
use Carp; |
|
36
|
|
|
|
|
63
|
|
|
36
|
|
|
|
|
5214
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub AUTOLOAD { |
8
|
|
|
|
|
|
|
# This AUTOLOAD is used to 'autoload' constants from the constant() |
9
|
|
|
|
|
|
|
# XS function. |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
8011
|
my $constname; |
12
|
2
|
|
|
|
|
4
|
our $AUTOLOAD; |
13
|
2
|
|
|
|
|
16
|
($constname = $AUTOLOAD) =~ s/.*:://; |
14
|
2
|
50
|
|
|
|
8
|
croak "&Git::Raw::Packbuilder::constant not defined" if $constname eq '_constant'; |
15
|
2
|
|
|
|
|
26
|
my ($error, $val) = _constant($constname); |
16
|
2
|
50
|
|
|
|
9
|
if ($error) { croak $error; } |
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
{ |
18
|
36
|
|
|
36
|
|
248
|
no strict 'refs'; |
|
36
|
|
|
|
|
74
|
|
|
36
|
|
|
|
|
2761
|
|
|
2
|
|
|
|
|
4
|
|
19
|
2
|
|
|
8
|
|
16
|
*$AUTOLOAD = sub { $val }; |
|
8
|
|
|
|
|
4263
|
|
20
|
|
|
|
|
|
|
} |
21
|
2
|
|
|
|
|
8
|
goto &$AUTOLOAD; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
36
|
|
|
36
|
|
261
|
use Git::Raw; |
|
36
|
|
|
|
|
101
|
|
|
36
|
|
|
|
|
1511
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Git::Raw::Packbuilder - Git packbuilder class |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 0.90 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use File::Spec::Functions qw(catfile); |
37
|
|
|
|
|
|
|
use Git::Raw; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $pb = Git::Raw::Packbuilder -> new($repo); |
40
|
|
|
|
|
|
|
$pb -> insert($commit); |
41
|
|
|
|
|
|
|
$pb -> write(catfile($repo -> path, 'objects', 'pack')); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
A L represents a git packfile builder. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 CONSTANTS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 ADDING_OBJECTS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Objects are being added to the object database. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 DELTAFICATION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Deltas are calculated/resolved. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 new( $repo ) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Create a new packbuilder. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 insert( $object, [$recursive = 1] ) |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Insert an object and by default its referenced objects. C<$object> may be |
66
|
|
|
|
|
|
|
a L, L, L or L. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 write( $path ) |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Write the new pack and corresponding index file to C<$path>. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 written( ) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Retrieve the number of objects the packbuilder has already written out. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 object_count( ) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Retrieve the total number of objects the packbuilder will write out. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 threads( $count ) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Set number of threads to spawn. By default libgit2 won't spawn any threads at all; |
83
|
|
|
|
|
|
|
when set to 0, libgit2 will autodetect the number of CPUs. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 hash( ) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Get the packfile's hash. A packfile's name is derived from the sorted hashing of all |
88
|
|
|
|
|
|
|
object names. This is only correct after the packfile has been written. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 callbacks( \%callbacks ) |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Set the callbacks for the packbuilder. See L>. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 CALLBACKS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 pack_progress |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
During the packing of new data, this will regularly be called with the progress |
99
|
|
|
|
|
|
|
of the pack operation. Be aware that this is called inline with pack |
100
|
|
|
|
|
|
|
building operations, so performance may be affected. The callback receives the |
101
|
|
|
|
|
|
|
following integers: |
102
|
|
|
|
|
|
|
C<$stage>, C<$current> and C<$total>. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 transfer_progress |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This will be regularly called with the current count of progress done by the |
107
|
|
|
|
|
|
|
indexer. The callback receives the following integers: C<$total_objects>, |
108
|
|
|
|
|
|
|
C<$received_objects>, C<$local_objects>, C<$total_deltas>, C<$indexed_deltas> |
109
|
|
|
|
|
|
|
and C<$received_bytes>. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Jacques Germishuys |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Copyright 2015 Jacques Germishuys. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
120
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
121
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; # End of Git::Raw::Packbuilder |