| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Git::CPAN::Patch::Role::Git; | 
| 2 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:YANICK'; | 
| 3 |  |  |  |  |  |  | #ABSTRACT: provides access to Git repository | 
| 4 |  |  |  |  |  |  | $Git::CPAN::Patch::Role::Git::VERSION = '2.3.1'; | 
| 5 | 1 |  |  | 1 |  | 921 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 35 |  | 
| 6 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 32 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 5 | use Method::Signatures::Simple; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 11 |  | 
| 9 | 1 |  |  | 1 |  | 344 | use version; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 9 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 1 |  |  | 1 |  | 68 | use Moose::Role; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 10 |  | 
| 12 | 1 |  |  | 1 |  | 6087 | use MooseX::App::Role; | 
|  | 1 |  |  |  |  | 1897 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 13 | 1 |  |  | 1 |  | 5260 | use MooseX::SemiAffordanceAccessor; | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 12 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 |  |  | 1 |  | 3077 | use Git::Repository; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 10 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | option root => ( | 
| 18 |  |  |  |  |  |  | is => 'rw', | 
| 19 |  |  |  |  |  |  | isa => 'Str', | 
| 20 |  |  |  |  |  |  | default => '.' , | 
| 21 |  |  |  |  |  |  | documentation => 'Location of the Git repository', | 
| 22 |  |  |  |  |  |  | ); | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | has git => ( | 
| 25 |  |  |  |  |  |  | is => 'ro', | 
| 26 |  |  |  |  |  |  | isa => 'Git::Repository', | 
| 27 |  |  |  |  |  |  | lazy => 1, | 
| 28 |  |  |  |  |  |  | default => method { | 
| 29 |  |  |  |  |  |  | Git::Repository->new( | 
| 30 |  |  |  |  |  |  | work_tree => $self->root | 
| 31 |  |  |  |  |  |  | ); | 
| 32 |  |  |  |  |  |  | }, | 
| 33 |  |  |  |  |  |  | handles => { | 
| 34 | 1 |  |  | 1 |  | 1054 | git_run => 'run', | 
|  | 3 |  |  | 3 |  | 10 |  | 
|  | 3 |  |  |  |  | 11 |  | 
| 35 | 3 |  |  |  |  | 9 | }, | 
|  | 3 |  |  |  |  | 32 |  | 
| 36 |  |  |  |  |  |  | ); | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 1 |  |  | 1 |  | 465 | method last_commit { | 
|  | 1 |  |  | 1 |  | 5 |  | 
|  | 1 |  |  |  |  | 3 |  | 
| 39 | 1 | 50 |  |  |  | 5 | eval { $self->git_run('rev-parse', '--verify', 'cpan/master') } | 
| 40 |  |  |  |  |  |  | } | 
| 41 | 0 |  |  |  |  | 0 |  | 
| 42 |  |  |  |  |  |  | method last_imported_version { | 
| 43 | 0 | 0 |  |  |  | 0 | my $last_commit = $self->last_commit or return version->parse(0); | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | my $last = join "\n", $self->git_run( log => '--pretty=format:%b', '-n', 1, $last_commit ); | 
| 46 | 0 |  |  |  |  | 0 |  | 
| 47 |  |  |  |  |  |  | $last =~ /git-cpan-module:\ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx | 
| 48 |  |  |  |  |  |  | or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n"; | 
| 49 | 1 |  |  | 1 |  | 518 |  | 
|  | 0 |  |  | 0 |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 50 | 0 | 0 |  |  |  | 0 | return version->parse($2); | 
| 51 |  |  |  |  |  |  | } | 
| 52 | 0 |  |  |  |  | 0 |  | 
| 53 |  |  |  |  |  |  | method tracked_distribution { | 
| 54 | 0 | 0 |  |  |  | 0 | my $last_commit = $self->last_commit or return; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | my $last = join "\n", $self->git_run( log => '--pretty=format:%b', '-n', 1, $last_commit ); | 
| 57 | 0 |  |  |  |  | 0 |  | 
| 58 |  |  |  |  |  |  | $last =~ /git-cpan-module:\s+ (.*?) \s+ git-cpan-version: \s+ (\S+)/sx | 
| 59 |  |  |  |  |  |  | or die "Couldn't parse message (not cloned via git cpan import?):\n$last\n"; | 
| 60 | 1 |  |  | 1 |  | 539 |  | 
|  | 1 |  |  | 1 |  | 6 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 61 | 1 |  |  |  |  | 7 | return $1; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | method first_import { | 
| 65 |  |  |  |  |  |  | return !$self->last_commit; | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | 1; | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | __END__ | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =pod | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | =encoding UTF-8 | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | =head1 NAME | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | Git::CPAN::Patch::Role::Git - provides access to Git repository | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =head1 VERSION | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | version 2.3.1 | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =head1 AUTHOR | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | Yanick Champoux <yanick@cpan.org> | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | This software is copyright (c) 2017 by Yanick Champoux. | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 93 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =cut |