line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::CPAN::Patch::Command::Clone; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Clone a CPAN module's history into a new git repository |
4
|
|
|
|
|
|
|
$Git::CPAN::Patch::Command::Clone::VERSION = '2.3.1'; |
5
|
1
|
|
|
1
|
|
61438
|
use 5.10.0; |
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
454
|
use autodie; |
|
1
|
|
|
|
|
14184
|
|
|
1
|
|
|
|
|
8
|
|
11
|
1
|
|
|
1
|
|
8442
|
use Path::Class; |
|
1
|
|
|
|
|
36107
|
|
|
1
|
|
|
|
|
57
|
|
12
|
1
|
|
|
1
|
|
562
|
use Method::Signatures::Simple; |
|
1
|
|
|
|
|
20680
|
|
|
1
|
|
|
|
|
7
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
829
|
use MooseX::App::Command; |
|
1
|
|
|
|
|
912286
|
|
|
1
|
|
|
|
|
5
|
|
15
|
|
|
|
|
|
|
extends 'Git::CPAN::Patch::Command::Import'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
parameter target => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
isa => 'Str', |
20
|
|
|
|
|
|
|
required => 0, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has _seen_imports => ( |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
isa => 'Bool', |
26
|
|
|
|
|
|
|
default => 0, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
before [ qw/import_release clone_git_repo /] => method($release) { |
31
|
|
|
|
|
|
|
return if $self->_seen_imports; |
32
|
|
|
|
|
|
|
$self->_set_seen_imports(1); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $target = $self->target || $release->dist_name; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
say "creating $target"; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
dir($target)->mkpath; |
39
|
|
|
|
|
|
|
Git::Repository->run( init => $target ); |
40
|
|
|
|
|
|
|
$self->set_root($target); |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
after [ qw/ clone_git_repo import_release /] => method { |
44
|
|
|
|
|
|
|
$self->git_run( 'reset', '--hard', $self->last_commit ); |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=encoding UTF-8 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Git::CPAN::Patch::Command::Clone - Clone a CPAN module's history into a new git repository |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
version 2.3.1 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# from a specific tarball |
68
|
|
|
|
|
|
|
$ git-cpan clone http://... |
69
|
|
|
|
|
|
|
$ git-cpan clone /path/to/Foo-Bar-0.03.tar.gz |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# from CPAN, module and dist names are okay |
72
|
|
|
|
|
|
|
$ git-cpan clone Foo::Bar |
73
|
|
|
|
|
|
|
$ git-cpan clone Foo-Bar |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# can also specify the directory to create |
76
|
|
|
|
|
|
|
$ git-cpan clone Foo-Bar my_clone |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 DESCRIPTION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Clones a CPAN distribution. If a tarball is given, either locally or via an |
81
|
|
|
|
|
|
|
url, it'll be used. If not, C<git-cpan> will try to find the distribution or |
82
|
|
|
|
|
|
|
module. If it has an official git repository, it'll be cloned. If not, the |
83
|
|
|
|
|
|
|
history will be created using the CPAN releases. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
If the target |
86
|
|
|
|
|
|
|
directory is omitted, then the "humanish" part of the distribution is used. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHORS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Mike Doherty C<< <doherty@cpan.org> >> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Yanick Champoux C<< <yanick@cpan.org> >> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SEE ALSO |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L<Git::CPAN::Patch>, L<git-cpan-init>, L<git-cpan-import> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Yanick Champoux. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
107
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |