File Coverage

blib/lib/Git/Flux/Command/feature.pm
Criterion Covered Total %
statement 9 26 34.6
branch 0 6 0.0
condition 0 3 0.0
subroutine 3 5 60.0
pod 2 2 100.0
total 14 42 33.3


line stmt bran cond sub pod time code
1             package Git::Flux::Command::feature;
2              
3 1     1   2786 use strict;
  1         4  
  1         55  
4 1     1   8 use warnings;
  1         2  
  1         37  
5 1     1   6 use mixin::with 'Git::Flux';
  1         2  
  1         11  
6              
7             sub feature {
8 0     0 1   my $self = shift;
9 0           my $cmd = shift;
10 0           my $method = "feature_$cmd";
11              
12             # dispatch to methods
13 0           $self->$method(@_);
14             }
15              
16             sub feature_start {
17 0     0 1   my $self = shift;
18 0           my ( $br_name, $fetch ) = @_;
19 0           my $repo = $self->{'repo'};
20              
21 0 0         $br_name or die "Missing argument \n";
22              
23 0           $self->require_branch_absent($br_name);
24              
25             # TODO: fetch flag handling
26              
27             # TODO: remove all hardcoding
28 0           my $devel_br = 'devel';
29 0   0       my $base = $fetch || $devel_br;
30              
31             # if remote exists, compare them
32 0 0         if ( $self->git_branch_exists("origin/$devel_br") ) {
33 0           $self->require_branches_equal( $devel_br, "origin/$devel_br" );
34             }
35              
36             # create branch
37 0           my $result = $repo->command( checkout => '-b', $br_name => $base );
38 0           $result->close();
39              
40 0 0         $result->exit == 0 or die "Could not create feature branch '$br_name'\n";
41              
42 0           print << "_END_REPORT";
43             Summary of actions:
44             - A new branch '$br_name' was created, based on '$base'
45             - You are now on branch '$br_name'
46              
47             Now, start committing on your feature. When done, use:
48              
49             git flow feature finish $br_name
50             _END_REPORT
51              
52             }
53              
54             1;
55              
56             __END__