toolbox/update-all-config.pl: quiet means quiet
[girocco.git] / toolbox / show-tags.pl
blobbb0db06d2e1f99494b265533823e2bdb822780de
1 #!/usr/bin/perl
3 # Show all projects ctags using the gitweb cache
4 # Use "show-tags.pl | sort -k2,2nr -k1,1f" to see in tag count order
6 use strict;
7 use warnings;
8 use lib "__BASEDIR__";
10 use Storable;
11 use Girocco::Config;
13 my $gwic = $Girocco::Config::projlist_cache_dir . "/gitweb.index.cache";
14 my $cache;
15 eval { $cache = retrieve($gwic); 1; } or die "Could not load cache file $gwic\n";
17 # Format of cache is:
18 # [ "format string", [[project hash refs in project name order], {project name => hashref}]]
20 # Each project hash ref has:
21 # owner => project owner name
22 # descr_long => project one liner description (from description file)
23 # age_epoch => time of last change (seconds since epoch)
24 # ctags => hash ref of tag => count (not present if ctags not enabled)
25 # path => $Girocco::Config::reporoot relative path to repository
26 # descr => truncated version of descr_long (typically 29-34 characters)
28 my %ctags = ();
30 foreach my $proj (@{$cache->[1][0]}) {
31 ref($proj) eq 'HASH' && ref($proj->{ctags}) eq 'HASH' or next;
32 while (my ($k,$v) = each(%{$proj->{ctags}})) {
33 $v =~ /^\d+$/ && $v or $v = 1;
34 $ctags{$k} += $v;
38 foreach my $tag (sort({lc($a) cmp lc($b) || $a cmp $b} keys(%ctags))) {
39 printf "%s\t%s\n", $tag, $ctags{$tag};
41 exit 0;