line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Group::Git::Cmd::Tag; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Created on: 2013-05-10 07:05:17 |
4
|
|
|
|
|
|
|
# Create by: Ivan Wills |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
# $Revision$, $HeadURL$, $Date$ |
7
|
|
|
|
|
|
|
# $Revision$, $Source$, $Date$ |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
404
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
10
|
1
|
|
|
1
|
|
343
|
use version; |
|
1
|
|
|
|
|
1166
|
|
|
1
|
|
|
|
|
4
|
|
11
|
1
|
|
|
1
|
|
427
|
use Moose::Role; |
|
1
|
|
|
|
|
287544
|
|
|
1
|
|
|
|
|
3
|
|
12
|
1
|
|
|
1
|
|
3321
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
13
|
1
|
|
|
1
|
|
576
|
use Data::Dumper qw/Dumper/; |
|
1
|
|
|
|
|
4610
|
|
|
1
|
|
|
|
|
55
|
|
14
|
1
|
|
|
1
|
|
485
|
use English qw/ -no_match_vars /; |
|
1
|
|
|
|
|
1178
|
|
|
1
|
|
|
|
|
5
|
|
15
|
1
|
|
|
1
|
|
669
|
use File::chdir; |
|
1
|
|
|
|
|
2120
|
|
|
1
|
|
|
|
|
71
|
|
16
|
1
|
|
|
1
|
|
530
|
use Term::ANSIColor qw/colored/; |
|
1
|
|
|
|
|
5175
|
|
|
1
|
|
|
|
|
235
|
|
17
|
1
|
|
|
1
|
|
437
|
use Getopt::Alt; |
|
1
|
|
|
|
|
167804
|
|
|
1
|
|
|
|
|
4
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = version->new('0.0.3'); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $opt = Getopt::Alt->new( |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
helper => 1, |
24
|
|
|
|
|
|
|
help => __PACKAGE__, |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
[ |
27
|
|
|
|
|
|
|
'min|m', |
28
|
|
|
|
|
|
|
'verbose|v+', |
29
|
|
|
|
|
|
|
] |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub tag { |
33
|
0
|
|
|
0
|
1
|
|
my ($self, $name) = @_; |
34
|
0
|
0
|
|
|
|
|
return unless -d $name; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$opt->process if !%{ $opt->opt || {} }; |
|
0
|
0
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $tag = shift @ARGV; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $repo = $self->repos->{$name}; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
local $CWD = $name; |
43
|
0
|
|
|
|
|
|
my %tags; |
44
|
0
|
|
|
|
|
|
for my $tag (`git tag`) { |
45
|
0
|
|
|
|
|
|
chomp $tag; |
46
|
0
|
|
|
|
|
|
$tags{$tag}++; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
my %branches; |
49
|
0
|
|
|
|
|
|
for my $branch (`git branch`) { |
50
|
0
|
|
|
|
|
|
chomp $branch; |
51
|
0
|
|
|
|
|
|
$branch =~ s/^.*\s//; |
52
|
0
|
|
|
|
|
|
$branches{$branch}++; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $count = 0; |
56
|
0
|
|
|
|
|
|
my $tagged = 0; |
57
|
0
|
|
|
|
|
|
my $i = 0; |
58
|
0
|
|
|
|
|
|
my @logs = `git log --format=format:'%h %d'`; |
59
|
0
|
|
|
|
|
|
my %logs; |
60
|
0
|
|
|
|
|
|
for (@logs) { |
61
|
0
|
|
|
|
|
|
$i++; |
62
|
0
|
|
|
|
|
|
chomp; |
63
|
0
|
|
|
|
|
|
my ($hash, $branc_tag) = split /\s[(]/, $_; |
64
|
0
|
|
0
|
|
|
|
$branc_tag ||= ''; |
65
|
0
|
|
|
|
|
|
chop $branc_tag; |
66
|
0
|
|
|
|
|
|
my $tag = join ', ', grep { $tags{$_} } map {/^(?:tag:\s+)?(.*)/; $1} split /,\s+/, $branc_tag; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$count++; |
68
|
0
|
|
|
|
|
|
my $min = !$tagged; |
69
|
0
|
0
|
|
|
|
|
$tagged++ if $tag; |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
$logs{$hash} = $tag ? $tag . colored(" ($count)", $min ? 'green' : '' ) : ''; |
|
|
0
|
|
|
|
|
|
72
|
0
|
0
|
0
|
|
|
|
last if $tag && $opt->opt->min; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
%logs |
76
|
|
|
|
|
|
|
= map { |
77
|
0
|
|
|
|
|
|
( $_ => $logs{$_} ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
grep { |
80
|
0
|
0
|
|
|
|
|
$logs{$_} && ( $tag ? $logs{$_} =~ /$tag/ : 1 ) |
|
0
|
0
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
keys %logs; |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
return unless %logs; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
return join '', map { |
87
|
0
|
|
|
|
|
|
"$_ $logs{$_}\n" |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
sort { |
90
|
0
|
|
|
|
|
|
my $A = $logs{$a}; |
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my $B = $logs{$b}; |
92
|
0
|
|
|
|
|
|
$A =~ s/(\d+)/sprintf '%06d', $1/eg; |
|
0
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$B =~ s/(\d+)/sprintf '%06d', $1/eg; |
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
$B cmp $A |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
keys %logs; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 NAME |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Group::Git::Cmd::Tag - Finds tags in each repository |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 VERSION |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This documentation refers to Group::Git::Cmd::Tag version 0.0.3 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SYNOPSIS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
group-git tag [options] |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Options: |
116
|
|
|
|
|
|
|
-m --min Show only tag with minimum number of commits |
117
|
|
|
|
|
|
|
-v --verbose Show more details about tags |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 DESCRIPTION |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 C<tag ($name)> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Does the work of finding tags |
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) 2013 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 |