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