blib/lib/Git/Raw/Packbuilder.pm

filter: Statementstmt 96.4% 27 / 28 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 92.3% 36 / 39 CC 3 SCAR 5.2
CC
3
Cov
91%
AUTOLOAD
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Git/Raw/Object.pm ↑ Summary blib/lib/Git/Raw/Rebase/Operation.pm »
1 package Git::Raw::Packbuilder;
2 87 $Git::Raw::Packbuilder::VERSION = '0.90';
3 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 87 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 87 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=11.1
8 # This AUTOLOAD is used to 'autoload' constants from the constant()
9 # XS function.
10  
11 2 my $constname;
12 2 our $AUTOLOAD;
13 2 ($constname = $AUTOLOAD) =~ s/.*:://;
14 2 ▶ croak "&Git::Raw::Packbuilder::constant not defined" if $constname eq '_constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "_constant" 0 2 2
15 2 my ($error, $val) = _constant($constname);
16 0 ▶ if ($error) { croak $error; }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 0 2 2
17 {
18 87 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: called CC=1 SCAR=0.0
20 }
21 2 goto &$AUTOLOAD;
22 }
23  
24 87 ▶use Git::Raw;
Subroutine BEGIN: called CC=1 SCAR=0.0
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<Git::Raw::Packbuilder> 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<Git::Raw::Commit>, L<Git::Raw::Tree>, L<Git::Raw::Blob> or L<Git::Raw::Walker>.
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<C<CALLBACKS>>.
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 <jacquesg@cpan.org>
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 87 1; # End of Git::Raw::Packbuilder
« blib/lib/Git/Raw/Object.pm ↑ Summary blib/lib/Git/Raw/Rebase/Operation.pm »