line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Git::Workflow::Command::Branches; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2017-09-28 09:32:00 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
90657
|
use strict; |
|
2
|
|
|
|
|
42
|
|
|
2
|
|
|
|
|
61
|
|
10
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
73
|
|
11
|
2
|
|
|
2
|
|
387
|
use version; |
|
2
|
|
|
|
|
1630
|
|
|
2
|
|
|
|
|
10
|
|
12
|
2
|
|
|
2
|
|
548
|
use English qw/ -no_match_vars /; |
|
2
|
|
|
|
|
3088
|
|
|
2
|
|
|
|
|
10
|
|
13
|
2
|
|
|
2
|
|
1101
|
use App::Git::Workflow; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
104
|
|
14
|
2
|
|
|
2
|
|
447
|
use App::Git::Workflow::Command qw/get_options/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1091
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = version->new(1.1.16); |
17
|
|
|
|
|
|
|
our $workflow = App::Git::Workflow->new; |
18
|
|
|
|
|
|
|
my ($name) = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs; |
19
|
|
|
|
|
|
|
our %option; |
20
|
|
|
|
|
|
|
our %p2u_extra; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub run { |
23
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
4
|
%option = ( |
26
|
|
|
|
|
|
|
exclude => [], |
27
|
|
|
|
|
|
|
); |
28
|
1
|
50
|
|
|
|
6
|
get_options( |
29
|
|
|
|
|
|
|
\%option, |
30
|
|
|
|
|
|
|
'remote|r', |
31
|
|
|
|
|
|
|
'all|a', |
32
|
|
|
|
|
|
|
'exclude|e=s@', |
33
|
|
|
|
|
|
|
'exclude_file|exclude-file|f=s', |
34
|
|
|
|
|
|
|
'max|n=i', |
35
|
|
|
|
|
|
|
'reverse|R', |
36
|
|
|
|
|
|
|
) or return; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# get the list of branches to look at |
39
|
1
|
|
|
|
|
3
|
my $max = 0; |
40
|
1
|
50
|
|
|
|
8
|
my @branches = $workflow->branches($option{remote} ? 'remote' : $option{all} ? 'both' : undef ); |
|
|
50
|
|
|
|
|
|
41
|
1
|
|
|
|
|
2
|
my @excludes = @{ $option{exclude} }; |
|
1
|
|
|
|
|
3
|
|
42
|
1
|
|
|
|
|
3
|
my ($total, $deleted) = (0, 0); |
43
|
|
|
|
|
|
|
|
44
|
1
|
50
|
|
|
|
2
|
if ($option{exclude_file}) { |
45
|
0
|
|
|
|
|
0
|
for my $exclude ($workflow->slurp($option{exclude_file})) { |
46
|
0
|
|
|
|
|
0
|
chomp $exclude; |
47
|
0
|
0
|
|
|
|
0
|
next if !$exclude; |
48
|
0
|
0
|
|
|
|
0
|
next if $exclude =~ /^\s*(?:[#].*)$/xms; |
49
|
0
|
|
|
|
|
0
|
push @excludes, $exclude; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
2
|
my @found; |
54
|
|
|
|
|
|
|
BRANCH: |
55
|
1
|
|
|
|
|
3
|
for my $branch (@branches) { |
56
|
|
|
|
|
|
|
# skip master branches |
57
|
0
|
0
|
|
|
|
0
|
next BRANCH if grep {$branch =~ /$_/} @excludes; |
|
0
|
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# get branch details |
60
|
0
|
|
|
|
|
0
|
push @found, $workflow->commit_details($branch, branches => 0); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
|
|
2
|
for (@found) { |
64
|
0
|
0
|
|
|
|
0
|
$max = length $_->{name} if length $_->{name} > $max; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
2
|
my $count = 0; |
68
|
1
|
50
|
|
|
|
3
|
if ( $option{reverse} ) { |
69
|
0
|
|
|
|
|
0
|
@found = reverse sort {$a->{time} <=> $b->{time}} @found; |
|
0
|
|
|
|
|
0
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
1
|
|
|
|
|
3
|
@found = sort {$a->{time} <=> $b->{time}} @found; |
|
0
|
|
|
|
|
0
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
2
|
for my $details (@found) { |
76
|
0
|
0
|
0
|
|
|
0
|
last if $option{max} && $count++ >= $option{max}; |
77
|
0
|
|
|
|
|
0
|
printf "%-${max}s %s\n", $details->{name}, scalar localtime $details->{time}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
2
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__DATA__ |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 NAME |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
git-branches - lists branches with dates of last commits |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 VERSION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This documentation refers to git-branches version 1.1.16 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SYNOPSIS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
git-branches [option] |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
OPTIONS: |
100
|
|
|
|
|
|
|
-r --remote Only remote branches (defaults to local branches) |
101
|
|
|
|
|
|
|
-a --all All branches |
102
|
|
|
|
|
|
|
-e --exclude[=]regex |
103
|
|
|
|
|
|
|
Regular expression to exclude specific branches from deletion. |
104
|
|
|
|
|
|
|
You can specify --exclude multiple times for more control. |
105
|
|
|
|
|
|
|
--exclude-file[=]file |
106
|
|
|
|
|
|
|
A file of exclude regular expressions, blank lines and lines |
107
|
|
|
|
|
|
|
starting with a hash (#) are ignored. |
108
|
|
|
|
|
|
|
-n --max[=]int |
109
|
|
|
|
|
|
|
Maximum number of branches to show |
110
|
|
|
|
|
|
|
-R --reverse Reverse the display order of branches |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
-v --verbose Show more detailed option |
113
|
|
|
|
|
|
|
--version Prints the version information |
114
|
|
|
|
|
|
|
--help Prints this help information |
115
|
|
|
|
|
|
|
--man Prints the full documentation for git-branches |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 DESCRIPTION |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
C<git-branches> aims to show details about all branches ordered by commit date. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 C<run ()> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Executes the git workflow command |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
There are no known bugs in this module. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Please report problems to Ivan Wills (ivan.wills@gmail.com). |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Patches are welcome. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 AUTHOR |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Ivan Wills - (ivan.wills@gmail.com) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Copyright (c) 2014 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). |
150
|
|
|
|
|
|
|
All rights reserved. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it under |
153
|
|
|
|
|
|
|
the same terms as Perl itself. See L<perlartistic>. This program is |
154
|
|
|
|
|
|
|
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
155
|
|
|
|
|
|
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
156
|
|
|
|
|
|
|
PARTICULAR PURPOSE. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |