| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# Created on: 2014-08-18 06:54:14 |
|
3
|
|
|
|
|
|
|
# Create by: Ivan Wills |
|
4
|
|
|
|
|
|
|
# $Id$ |
|
5
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
|
6
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use strict; |
|
9
|
25
|
|
|
25
|
|
142
|
use warnings; |
|
|
25
|
|
|
|
|
46
|
|
|
|
25
|
|
|
|
|
634
|
|
|
10
|
25
|
|
|
25
|
|
176
|
use version; |
|
|
25
|
|
|
|
|
46
|
|
|
|
25
|
|
|
|
|
604
|
|
|
11
|
25
|
|
|
25
|
|
106
|
use Carp; |
|
|
25
|
|
|
|
|
68
|
|
|
|
25
|
|
|
|
|
148
|
|
|
12
|
25
|
|
|
25
|
|
1351
|
use Data::Dumper qw/Dumper/; |
|
|
25
|
|
|
|
|
45
|
|
|
|
25
|
|
|
|
|
1204
|
|
|
13
|
25
|
|
|
25
|
|
158
|
use English qw/ -no_match_vars /; |
|
|
25
|
|
|
|
|
51
|
|
|
|
25
|
|
|
|
|
1056
|
|
|
14
|
25
|
|
|
25
|
|
139
|
use Git; |
|
|
25
|
|
|
|
|
40
|
|
|
|
25
|
|
|
|
|
106
|
|
|
15
|
25
|
|
|
25
|
|
18191
|
use File::Spec; |
|
|
25
|
|
|
|
|
414594
|
|
|
|
25
|
|
|
|
|
1507
|
|
|
16
|
25
|
|
|
25
|
|
204
|
use base qw/Exporter/; |
|
|
25
|
|
|
|
|
47
|
|
|
|
25
|
|
|
|
|
581
|
|
|
17
|
25
|
|
|
25
|
|
115
|
|
|
|
25
|
|
|
|
|
46
|
|
|
|
25
|
|
|
|
|
13593
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = version->new(1.1.20); |
|
19
|
|
|
|
|
|
|
our @EXPORT = qw/git/; |
|
20
|
|
|
|
|
|
|
our @EXPORT_OK = qw//; |
|
21
|
|
|
|
|
|
|
our %EXPORT_TAGS = (); |
|
22
|
|
|
|
|
|
|
our $last; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $class = shift; |
|
25
|
|
|
|
|
|
|
my $self = { repository => @_ || undef }; |
|
26
|
0
|
|
|
0
|
1
|
|
if (!$self->{repository}) { |
|
27
|
0
|
|
0
|
|
|
|
my @dir = File::Spec->splitdir( File::Spec->rel2abs( File::Spec->curdir ) ); |
|
28
|
0
|
0
|
|
|
|
|
while ( |
|
29
|
0
|
|
|
|
|
|
@dir > 1 |
|
30
|
0
|
|
0
|
|
|
|
&& ! -d File::Spec->catdir(@dir, '.git') |
|
31
|
|
|
|
|
|
|
) { |
|
32
|
|
|
|
|
|
|
pop @dir; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
0
|
|
|
|
|
|
$self->{repository} = File::Spec->catdir(@dir) || ''; |
|
35
|
|
|
|
|
|
|
die "Couldn't find the git repository! '$self->{repository}'\n" if !-d $self->{repository}; |
|
36
|
0
|
|
0
|
|
|
|
} |
|
37
|
0
|
0
|
|
|
|
|
$self->{git} = Git->repository(Directory => $self->{repository}); |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
bless $self, $class; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $last = $self; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
0
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
return $last || App::Git::Workflow::Repository->new; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
0
|
0
|
1
|
|
our $AUTOLOAD; |
|
48
|
|
|
|
|
|
|
my $self = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $called = $AUTOLOAD; |
|
51
|
|
|
|
|
|
|
$called =~ s/.*:://; |
|
52
|
0
|
|
|
0
|
|
|
$called =~ s/_/-/g; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
if ($ENV{REPO_RECORD}) { |
|
55
|
0
|
|
|
|
|
|
open my $fh, '>>', '/tmp/repo-record.txt'; |
|
56
|
0
|
|
|
|
|
|
my ($result, @result); |
|
57
|
|
|
|
|
|
|
if (wantarray) { |
|
58
|
0
|
0
|
|
|
|
|
@result = $self->{git}->command($called, @_); |
|
59
|
0
|
|
|
|
|
|
} |
|
60
|
0
|
|
|
|
|
|
else { |
|
61
|
0
|
0
|
|
|
|
|
$result = $self->{git}->command($called, @_); |
|
62
|
0
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
print {$fh} Dumper [$called, \@_, { scalar => $result, array => \@result }]; |
|
64
|
|
|
|
|
|
|
return wantarray ? @result : $result; |
|
65
|
0
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return if !$self || !$self->{git}; |
|
|
0
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
warn "running : " . ( |
|
70
|
|
|
|
|
|
|
$self->{git}->can($called) |
|
71
|
0
|
0
|
0
|
|
|
|
? "git->$called(@_)" |
|
72
|
|
|
|
|
|
|
: "git->command($called, @_)" |
|
73
|
|
|
|
|
|
|
) . "\n" if $ENV{GW_VERBOSE}; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
return $self->{git}->can($called) |
|
76
|
|
|
|
|
|
|
? $self->{git}->$called(@_) |
|
77
|
0
|
0
|
|
|
|
|
: $self->{git}->command($called, @_); |
|
|
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
0
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 NAME |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
App::Git::Workflow::Repository - A basic wrapper around GIT |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 VERSION |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This documentation refers to App::Git::Workflow::Repository version 1.1.20 |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
use App::Git::Workflow::Repository qw/git/; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# get the git object based on the current directory |
|
96
|
|
|
|
|
|
|
my $git = git(); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# call git sub commands |
|
99
|
|
|
|
|
|
|
$git->log('--oneline'); |
|
100
|
|
|
|
|
|
|
$git->show('123ABC'); |
|
101
|
|
|
|
|
|
|
$git->status(); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is a thin wrapper around L<Git> that will default to using the current |
|
106
|
|
|
|
|
|
|
directory for C<git>, adds a simple way of calling git sub-commands |
|
107
|
|
|
|
|
|
|
as methods. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head3 C<new (%options)> |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Returns a new App::Git::Workflow::Repository |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 C<git ()> |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Singleton to get the last created C<App::Git::Workflow::Repository> object or |
|
118
|
|
|
|
|
|
|
create a new one. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
There are no known bugs in this module. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Patches are welcome. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Copyright (c) 2014 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
|
143
|
|
|
|
|
|
|
All rights reserved. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
|
146
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
|
147
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
148
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
149
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |