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