File Coverage

blib/lib/App/Git/Workflow/Command/Pushb.pm
Criterion Covered Total %
statement 31 31 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 42 42 100.0


line stmt bran cond sub pod time code
1             package App::Git::Workflow::Command::Pushb;
2              
3             # Created on: 2014-03-11 20:58:59
4             # Create by: Ivan Wills
5             # $Id$
6             # $Revision$, $HeadURL$, $Date$
7             # $Revision$, $Source$, $Date$
8              
9 2     2   104808 use strict;
  2         15  
  2         61  
10 2     2   12 use warnings;
  2         4  
  2         50  
11 2     2   479 use version;
  2         1952  
  2         11  
12 2     2   653 use English qw/ -no_match_vars /;
  2         3684  
  2         13  
13 2     2   1325 use Term::ANSIColor qw/colored/;
  2         8493  
  2         1795  
14 2     2   484 use App::Git::Workflow::Brs;
  2         5  
  2         111  
15 2     2   512 use App::Git::Workflow::Command qw/get_options/;
  2         5  
  2         619  
16              
17             our $VERSION = version->new(1.1.16);
18             our $workflow = App::Git::Workflow::Brs->new;
19             our ($name) = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs;
20             our %option;
21              
22             sub run {
23 2     2 1 14 get_options(
24             \%option,
25             'n',
26             );
27              
28 2         5 my $new_branch = shift @ARGV;
29 2 100       8 if ( ! $new_branch ) {
30 1         8 die "git pushb: no other branch\n";
31             }
32              
33 1         8 my @lines = $workflow->get_brs();
34 1         10 my ($sha, $current) = $workflow->current();
35              
36 1         6 unshift @lines, "$current";
37 1         7 $workflow->git->checkout($new_branch);
38              
39 1         8 $workflow->set_brs(@lines);
40              
41 1         78 print join ' ', @lines, "\n";
42             }
43              
44             1;
45              
46             __DATA__
47              
48             =head1 NAME
49              
50             git-pushb - Help pushb many commits
51              
52             =head1 VERSION
53              
54             This documentation refers to git-pushb version 1.1.16
55              
56             =head1 SYNOPSIS
57              
58             git-pushb [option] branch
59              
60             OPTIONS:
61              
62             -v --verbose Show more detailed option
63             --version Prints the version information
64             --help Prints this help information
65             --man Prints the full documentation for git-pushb
66              
67             =head1 DESCRIPTION
68              
69             Change to branch saving the current branch / commit so you can switch back
70             at a point
71              
72             =head1 SUBROUTINES/METHODS
73              
74             =head2 C<run ()>
75              
76             Executes the git workflow command
77              
78             =head1 DIAGNOSTICS
79              
80             =head1 CONFIGURATION AND ENVIRONMENT
81              
82             =head1 DEPENDENCIES
83              
84             =head1 INCOMPATIBILITIES
85              
86             =head1 BUGS AND LIMITATIONS
87              
88             There are no known bugs in this module.
89              
90             Please report problems to Ivan Wills (ivan.wills@gmail.com).
91              
92             Patches are welcome.
93              
94             =head1 AUTHOR
95              
96             Ivan Wills - (ivan.wills@gmail.com)
97              
98             =head1 LICENSE AND COPYRIGHT
99              
100             Copyright (c) 2014 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
101             All rights reserved.
102              
103             This module is free software; you can redistribute it and/or modify it under
104             the same terms as Perl itself. See L<perlartistic>. This program is
105             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
106             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
107             PARTICULAR PURPOSE.
108              
109             =cut