line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Group::Git::Cmd::State; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2013-05-06 21:57:07 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
880
|
use Moo::Role; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
13
|
|
10
|
1
|
|
|
1
|
|
2807
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
11
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
12
|
1
|
|
|
1
|
|
7
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
13
|
1
|
|
|
1
|
|
75
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
107
|
|
14
|
1
|
|
|
1
|
|
8
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
15
|
1
|
|
|
1
|
|
519
|
use File::chdir; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
80
|
|
16
|
1
|
|
|
1
|
|
8
|
use Getopt::Alt; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = version->new('0.7.7'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
requires 'repos'; |
21
|
|
|
|
|
|
|
requires 'verbose'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $opt = Getopt::Alt->new( |
24
|
|
|
|
|
|
|
{ help => __PACKAGE__, }, |
25
|
|
|
|
|
|
|
[ |
26
|
|
|
|
|
|
|
'quiet|q', |
27
|
|
|
|
|
|
|
] |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub state_start { |
31
|
0
|
|
|
0
|
1
|
|
$opt->process; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub state { |
37
|
0
|
|
|
0
|
1
|
|
my ($self, $name) = @_; |
38
|
0
|
0
|
|
|
|
|
return unless -d $name; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $repo = $self->repos->{$name}; |
41
|
0
|
|
|
|
|
|
my $cmd; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
local $CWD = $name; |
44
|
0
|
|
|
|
|
|
my $branch = `git rev-parse --abbrev-ref HEAD 2>&1`; |
45
|
0
|
|
|
|
|
|
chomp $branch; |
46
|
0
|
0
|
|
|
|
|
if ( $branch =~ /ambiguous argument 'HEAD'/ ) { |
47
|
0
|
|
|
|
|
|
$branch = 'initial commit'; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
my $status = `git status --porcelain 2>&1`; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return $branch . ($status ? ' *' : ''); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub state_end { |
55
|
0
|
|
|
0
|
1
|
|
return "\n"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Group::Git::Cmd::State - Quick state of each repository (branch name and changes) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 VERSION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This documentation refers to Group::Git::Cmd::State version 0.7.7. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SYNOPSIS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
group-git state |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This command allows the quick finding out of state (i.e. the branch name and |
77
|
|
|
|
|
|
|
weather there are uncommitted changes) for each repository. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over 4 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item C<state ($name)> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Shows the repository branch and weather there are changes in it. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item C<state_start ()> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Process the command line arguments for state |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item C<state_end ()> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
For adding find new line |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
There are no known bugs in this module. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Patches are welcome. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Copyright (c) 2013 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
120
|
|
|
|
|
|
|
All rights reserved. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
123
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
124
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
125
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
126
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |