blib/lib/Git/Raw/Reflog.pm

filter: Statementstmt 100% 8 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 10 / 10 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Git/Raw/Reference.pm ↑ Summary blib/lib/Git/Raw/Reflog/Entry.pm »
1 package Git::Raw::Reflog;
2 1 $Git::Raw::Reflog::VERSION = '0.90';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Git::Raw::Reflog - Git reflog class
9  
10 =head1 VERSION
11  
12 version 0.90
13  
14 =head1 SYNOPSIS
15  
16 use Git::Raw;
17  
18 # open the Git repository at $path
19 my $repo = Git::Raw::Repository -> open($path);
20  
21 # get the master branch
22 my $master = Git::Raw::Branch -> lookup($repo, 'master', 1);
23  
24 # retrieve the reflog for 'master'
25 my $reflog = $master -> reflog;
26  
27 # print out reflog information
28 my @entries = $reflog -> entries;
29 foreach my $entry (@entries) {
30 my $committer = $entry -> committer;
31 print "Committer:", "\n";
32 print "\t", "Name: ", $committer -> name, "\n";
33 print "\t", "E-Mail ", $committer -> email, "\n";
34 print "\t", "Time: ", $committer -> time, "\n";
35 print "\t", "Offset: ", $committer -> offset, "\n";
36 print "\n";
37  
38 print "Message: ", $entry -> message, "\n";
39 print "Old id: ", $entry -> old_id, "\n";
40 print "New id: ", $entry -> new_id, "\n";
41 }
42  
43 # add a new entry to the reflog
44 my $signature = Git::Raw::Signature -> default($repo);
45 $reflog -> append("Hello", $signature);
46 $reflog -> write;
47  
48 # drop an entry from the reflog
49 $reflog -> drop(0);
50 $reflog -> write;
51  
52 # remove the reflog
53 $reflog -> delete;
54 $reflog -> write;
55  
56 =head1 DESCRIPTION
57  
58 A C<Git::Raw::Reflog> represents a Git reflog.
59  
60 B<WARNING>: The API of this module is unstable and may change without warning
61 (any change will be appropriately documented in the changelog).
62  
63 =head1 METHODS
64  
65 =head2 open( $reference )
66  
67 Open the reflog for the reference C<$reference>.
68  
69 =head2 delete( )
70  
71 Delete the reflog for the reference.
72  
73 =head2 append( $message [, $signature])
74  
75 Add a new entry to the reflog. If C<$signature> is not provided,
76 the default signature, C<Git::Raw::Signature-E<gt>default()> will be used.
77  
78 =head2 drop( $index )
79  
80 Remove entry C<$index> from the reflog.
81  
82 =head2 write( )
83  
84 Write the reflog back to disk.
85  
86 =head2 entry_count( )
87  
88 Retrieve the number of entries in the reflog.
89  
90 =head2 entries( [$index, $count] )
91  
92 Retrieve a list of L<Git::Raw::Reflog::Entry> objects.
93  
94 =head1 AUTHOR
95  
96 Alessandro Ghedini <alexbio@cpan.org>
97  
98 Jacques Germishuys <jacquesg@cpan.org>
99  
100 =head1 LICENSE AND COPYRIGHT
101  
102 Copyright 2014 Alessandro Ghedini.
103  
104 This program is free software; you can redistribute it and/or modify it
105 under the terms of either: the GNU General Public License as published
106 by the Free Software Foundation; or the Artistic License.
107  
108 See http://dev.perl.org/licenses/ for more information.
109  
110 =cut
111  
112 1 1; # End of Git::Raw::Reflog
« blib/lib/Git/Raw/Reference.pm ↑ Summary blib/lib/Git/Raw/Reflog/Entry.pm »