File Coverage

blib/lib/App/Git/Workflow/Command/Popb.pm
Criterion Covered Total %
statement 25 29 86.2
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 35 40 87.5


line stmt bran cond sub pod time code
1             package App::Git::Workflow::Command::Popb;
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   105840 use strict;
  2         30  
  2         61  
10 2     2   12 use warnings;
  2         5  
  2         69  
11 2     2   461 use version;
  2         1967  
  2         14  
12 2     2   689 use English qw/ -no_match_vars /;
  2         3705  
  2         16  
13 2     2   1361 use Term::ANSIColor qw/colored/;
  2         8599  
  2         1830  
14 2     2   541 use App::Git::Workflow::Brs;
  2         4  
  2         110  
15 2     2   542 use App::Git::Workflow::Command qw/get_options/;
  2         7  
  2         622  
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 1     1 1 7 get_options(
24             \%option,
25             'n',
26             );
27              
28 1         6 my @lines = $workflow->get_brs();
29              
30 1 50       14 if ( ! @lines ) {
31 1         9 die "popb: branch stack empty\n";
32             }
33              
34 0           my $new_branch = pop @lines;
35 0           $workflow->git->checkout($new_branch);
36              
37 0           $workflow->set_brs(@lines);
38              
39 0           print join ' ', @lines, "\n";
40             }
41              
42             1;
43              
44             __DATA__
45              
46             =head1 NAME
47              
48             git-popb - Help popb many commits
49              
50             =head1 VERSION
51              
52             This documentation refers to git-popb version 1.1.16
53              
54             =head1 SYNOPSIS
55              
56             git-popb [option]
57              
58             OPTIONS:
59             -n Supress normal branch change output
60              
61             -v --verbose Show more detailed option
62             --version Prints the version information
63             --help Prints this help information
64             --man Prints the full documentation for git-popb
65              
66             =head1 DESCRIPTION
67              
68             Short hand for running
69              
70             C<git commit --popb>
71              
72             Over more than one commit in the history
73              
74             =head1 SUBROUTINES/METHODS
75              
76             =head2 C<run ()>
77              
78             Executes the git workflow command
79              
80             =head1 DIAGNOSTICS
81              
82             =head1 CONFIGURATION AND ENVIRONMENT
83              
84             =head1 DEPENDENCIES
85              
86             =head1 INCOMPATIBILITIES
87              
88             =head1 BUGS AND LIMITATIONS
89              
90             There are no known bugs in this module.
91              
92             Please report problems to Ivan Wills (ivan.wills@gmail.com).
93              
94             Patches are welcome.
95              
96             =head1 AUTHOR
97              
98             Ivan Wills - (ivan.wills@gmail.com)
99              
100             =head1 LICENSE AND COPYRIGHT
101              
102             Copyright (c) 2014 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
103             All rights reserved.
104              
105             This module is free software; you can redistribute it and/or modify it under
106             the same terms as Perl itself. See L<perlartistic>. This program is
107             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
108             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
109             PARTICULAR PURPOSE.
110              
111             =cut