Patch/Command/Update.pm

filter: Statementstmt 83.3% 25 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod n/a totaltotal 73.8% 31 / 42 CC 3 SCAR 11.0
CC
3
Cov
74%
__ANON__
6.0
__ANON__
6.0
BEGIN
1.0
CRAP 3.0
« Patch/Role/Git.pm ↑ Summary Patch.pm »
1 package Git::CPAN::Patch::Command::Update;
2 1 our $AUTHORITY = 'cpan:YANICK';
3 #ABSTRACT: Import the latest version of a module and rebase the current branch
4 1 $Git::CPAN::Patch::Command::Update::VERSION = '2.3.4';
5 1 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Git::Repository;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use MooseX::App::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 extends 'Git::CPAN::Patch::Command::Import';
15  
16 1 use experimental qw/
17 signatures
18 postderef
19 1 ▶/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 #TODO check for versions before download
22  
23 1 has last_import_before_run => (
24 is => 'rw',
25 );
26  
27 ▶before run => sub ($self) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
28 0 ▶ eval { $self->set_last_import_before_run($self->last_commit) }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->set_last_import_before_run($self->last_commit) } } or die "branch 'cpan/master' doesn't exist yet (import first)\n" 0 0 0
29 or die "branch 'cpan/master' doesn't exist yet (import first)\n";
30 0 $self->set_thing_to_import( $self->tracked_distribution );
31 1 };
32  
33 ▶after run => sub ($self) {
Subroutine __ANON__: not called CC=2 SCAR=17.9
34 0 ▶ return if $self->last_import_before_run eq $self->last_commit;
Branch: 1 branch
BranchTrueFalseTotal
if $self->last_import_before_run eq $self->last_commit 0 0 0
35  
36 0 $self->git_run( rebase => 'cpan/master' );
37 1 };
38  
39 1 __PACKAGE__->meta->make_immutable;
40  
41 1 1;
42  
43 __END__
44  
45 =pod
46  
47 =encoding UTF-8
48  
49 =head1 NAME
50  
51 Git::CPAN::Patch::Command::Update - Import the latest version of a module and rebase the current branch
52  
53 =head1 VERSION
54  
55 version 2.3.4
56  
57 =head1 SYNOPSIS
58  
59 % git-cpan update
60  
61 =head1 DESCRIPTION
62  
63 This command runs C<git-cpan import>, and then if C<cpan/master> was updated
64 runs C<git rebase cpan/master>, bringing your patches up to date with the
65 upstream.
66  
67 =head1 AUTHORS
68  
69 Yuval Kogman C<< <nothingmuch@woobling.org> >>
70  
71 Yanick Champoux C<< <yanick@cpan.org> >>
72  
73 =head1 SEE ALSO
74  
75 L<Git::CPAN::Patch>, L<git-cpan-import>
76  
77 =head1 AUTHOR
78  
79 Yanick Champoux <yanick@cpan.org>
80  
81 =head1 COPYRIGHT AND LICENSE
82  
83 This software is copyright (c) 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009 by Yanick Champoux.
84  
85 This is free software; you can redistribute it and/or modify it under
86 the same terms as the Perl 5 programming language system itself.
87  
88 =cut
« Patch/Role/Git.pm ↑ Summary Patch.pm »