Patch/Command/Squash.pm

filter: Statementstmt 80.0% 24 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 1 totaltotal 73.1% 30 / 41 CC 4 SCAR 15.9
CC
4
Cov
75%
run
12.0
__ANON__
6.0
BEGIN
1.0
CRAP 4.9
« Patch/Release.pm ↑ Summary Patch/Role/Patch.pm »
1 package Git::CPAN::Patch::Command::Squash;
2 1 our $AUTHORITY = 'cpan:YANICK';
3 #ABSTRACT: Combine multiple commits into one patch
4 1 $Git::CPAN::Patch::Command::Squash::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 with 'Git::CPAN::Patch::Role::Git';
15  
16 1 use experimental qw/
17 signatures
18 postderef
19 1 ▶/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 has first_arg => (
22 is => 'ro',
23 isa => 'Str',
24 required => 0,
25 );
26  
27 ▶has branch => (
Subroutine __ANON__: not called CC=2 SCAR=17.9
28 is => 'ro',
29 isa => 'Str',
30 lazy => 1,
31 default => sub ($self) {
32 0 ▶ $self->first_arg || 'patch';
Branch: 1 branch
BranchTrueFalseTotal
$self->first_arg or "patch" 0 0 0
33 },
34 1 );
35  
36 ▶sub run ($self) {
Subroutine run: not called CC=3 SCAR=24.8
Pod undocumented
37 0 my $head = $self->git_run("rev-parse", "--verify", "HEAD");
38  
39 0 say for $self->git_run("checkout", "-b", $self->branch, "cpan/master");
40  
41 0 say for $self->git_run("merge", "--squash", $head);
42  
43 0 say "";
44  
45 0 say "Changes squashed onto working directory, commit and run git-cpan send_patch";
46 }
47  
48 1 __PACKAGE__->meta->make_immutable;
49  
50 1 1;
51  
52 __END__
53  
54 =pod
55  
56 =encoding UTF-8
57  
58 =head1 NAME
59  
60 Git::CPAN::Patch::Command::Squash - Combine multiple commits into one patch
61  
62 =head1 VERSION
63  
64 version 2.3.4
65  
66 =head1 SYNOPSIS
67  
68 % git-cpan squash temp_submit_branch
69  
70 % git commit -m "This is my message"
71  
72 % git-cpan send-patch --compose
73  
74 # delete the branch now that we're done
75 % git checkout master
76 % git branch -D temp_submit_branch
77  
78 =head1 DESCRIPTION
79  
80 This command creates a new branch from C<cpan/master> runs
81 C<git merge --squash> against your head revision. This stages all the files for
82 the branch and allows you to create a combined commit in order to send a single
83 patch easily.
84  
85 =head1 AUTHOR
86  
87 Yanick Champoux <yanick@cpan.org>
88  
89 =head1 COPYRIGHT AND LICENSE
90  
91 This software is copyright (c) 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009 by Yanick Champoux.
92  
93 This is free software; you can redistribute it and/or modify it under
94 the same terms as the Perl 5 programming language system itself.
95  
96 =cut
« Patch/Release.pm ↑ Summary Patch/Role/Patch.pm »