line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::CPAN::Patch; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Patch CPAN modules using Git |
4
|
|
|
|
|
|
|
$Git::CPAN::Patch::VERSION = '2.3.1'; |
5
|
2
|
|
|
2
|
|
52502
|
use 5.10.1; |
|
2
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
36
|
|
8
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
53
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
786
|
use MooseX::App 1.21; |
|
2
|
|
|
|
|
951753
|
|
|
2
|
|
|
|
|
11
|
|
11
|
2
|
|
|
2
|
|
1390373
|
use MooseX::SemiAffordanceAccessor; |
|
2
|
|
|
|
|
24101
|
|
|
2
|
|
|
|
|
14
|
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
95771
|
use MetaCPAN::API; |
|
2
|
|
|
|
|
199168
|
|
|
2
|
|
|
|
|
67
|
|
14
|
2
|
|
|
2
|
|
431
|
use Method::Signatures::Simple 1.07; |
|
2
|
|
|
|
|
7013
|
|
|
2
|
|
|
|
|
16
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
app_base 'git-cpan'; |
17
|
|
|
|
|
|
|
app_namespace 'Git::CPAN::Patch::Command'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
app_command_name { |
20
|
|
|
|
|
|
|
join '-', map { lc } $_[0] =~ /([A-Z]+[a-z]+)/g; |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
option man => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
isa => 'Bool', |
26
|
|
|
|
|
|
|
default => 0, |
27
|
|
|
|
|
|
|
lazy => 1, |
28
|
|
|
|
|
|
|
trigger => sub { |
29
|
|
|
|
|
|
|
require Pod::Usage; |
30
|
|
|
|
|
|
|
my $name = $_[0]->meta->name . '.pm'; |
31
|
|
|
|
|
|
|
$name =~ s#::#/#g; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
exit Pod::Usage::pod2usage( |
34
|
|
|
|
|
|
|
-verbose => 2, |
35
|
|
|
|
|
|
|
-input => $INC{$name} |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
documentation => q{Prints the command's manpage}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has target => ( |
42
|
|
|
|
|
|
|
is => 'rw', |
43
|
|
|
|
|
|
|
isa => 'Str', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has distribution_name => ( |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
lazy_build => 1, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has distribution_meta => ( |
52
|
|
|
|
|
|
|
isa => 'HashRef', |
53
|
|
|
|
|
|
|
is => 'ro', |
54
|
|
|
|
|
|
|
lazy_build => 1, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has repo => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
lazy_build => 1, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
2
|
|
1935
|
method _build_repo { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
Git::Repository->new( ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
2
|
|
874
|
method _build_distribution_name { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $target = $self->target; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$target =~ s/-/::/g; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $mcpan = MetaCPAN::API->new; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $mcpan->module( $target )->{distribution}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
2
|
|
858
|
method _build_distribution_meta { |
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $mcpan = MetaCPAN::API->new; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$mcpan->release( distribution => $self->distribution_name ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
'end of module Git::CPAN::Patch'; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=encoding UTF-8 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Git::CPAN::Patch - Patch CPAN modules using Git |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 VERSION |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
version 2.3.1 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SYNOPSIS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# import a module: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
% git-cpan clone Foo::Bar |
103
|
|
|
|
|
|
|
% cd Foo-Bar |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# hack and submit to RT |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# it's probably best to work in a branch |
108
|
|
|
|
|
|
|
% git checkout -b blah |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
... hack lib/Foo/Bar.pm ... |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
% git commit -am "blah" |
113
|
|
|
|
|
|
|
% git-cpan sendpatch |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# update the module |
116
|
|
|
|
|
|
|
# this automatically rebases the current branch |
117
|
|
|
|
|
|
|
% git-cpan update |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 DESCRIPTION |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<Git::CPAN::Patch> provides a suite of git commands |
122
|
|
|
|
|
|
|
aimed at making trivially |
123
|
|
|
|
|
|
|
easy the process of grabbing |
124
|
|
|
|
|
|
|
any distribution off CPAN, stuffing it |
125
|
|
|
|
|
|
|
in a local git repository and, once gleeful |
126
|
|
|
|
|
|
|
hacking has been perpetrated, sending back |
127
|
|
|
|
|
|
|
patches to its maintainer. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
NOTE: This module is supported in Linux, BSD, and the like. This |
130
|
|
|
|
|
|
|
module is B<not> supported in Microsoft Windows (Cygwin, Strawberry Perl). |
131
|
|
|
|
|
|
|
See L<CPAN Testers Matrix|http://matrix.cpantesters.org/?dist=Git-CPAN-Patch> |
132
|
|
|
|
|
|
|
for currently supported operating systems. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 GIT-CPAN COMMANDS |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=over |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item L<clone|Git::CPAN::Patch::Command::Clone> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Clone a CPAN module's history into a new git repository |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item L<import|Git::CPAN::Patch::Command::Import> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Import a module into a git repository. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item L<send-email|Git::CPAN::Patch::Command::SendEmail> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Use C<git-send-email> to submit patches to CPAN RT |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item L<send-patch|Git::CPAN::Patch::Command::SendPatch> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Create patch files and submit then to RT |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item L<update|Git::CPAN::Patch::Command::Update> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Import the latest version of a module and rebase the current branch |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item L<format-patch|Git::CPAN::Patch::Command::FormatPatch> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Format patches using C<cpan/master> as the origin reference |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item L<squash|Git::CPAN::Patch::Command::Squash> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Combine multiple commits into one patch |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item L<which|Git::CPAN::Patch::Command::Which> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Report upon the managed module |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=back |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 AUTHORS |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Yanick Champoux C<< <yanick@cpan.org> >> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Yuval Kogman C<< <nothingmuch@woobling.org> >> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 SEE ALSO |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 Articles |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
The set of scripts that would eventually become |
183
|
|
|
|
|
|
|
L<Git::CPAN::Patch> were first presented in the |
184
|
|
|
|
|
|
|
article I<CPAN Patching with Git>, published in |
185
|
|
|
|
|
|
|
issue 5.1 of L<The Perl Review|http://theperlreview.com>. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHOR |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Yanick Champoux. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
196
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
__END__ |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# TODO add back --compose to sendpatch |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|