diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2012-06-12 03:34:33 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2012-06-12 03:36:01 +0200 |
commit | 9852f01df91cdf5bb5ac924d2354eac8a6481df7 (patch) | |
tree | 38e7980895a8a10d690fad8defbb9ef514b1c16f /bin/lo-commit-stat | |
parent | 40b7eff9075c88d80fb0f3472d2671c5d2c72d0d (diff) |
Optionally output wiki-markup from lo-commit-stat
Starts to be a bit annoying to roll shell-sed every release.
We fix too many bugs.
Change-Id: I34b0e9c2bf2c43f84abd555a9d2ac7dde0b6ba3a
Diffstat (limited to 'bin/lo-commit-stat')
-rwxr-xr-x | bin/lo-commit-stat | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat index 0697432e333f..310548ef116c 100755 --- a/bin/lo-commit-stat +++ b/bin/lo-commit-stat @@ -25,11 +25,16 @@ sub search_bugs($$$$) my $bug_orig; while (defined $bug) { - # match fdo#123, rhz#123, i#123 + # match fdo#123, rhz#123, i#123, #123 # but match only bug number with >= 4 digits - if ( $line =~ m/(\w*\#+\d{4,})/ ) { + if ( $line =~ m/(\w+\#+\d{4,})/ ) { $bug_orig = $1; $bug = $1; + # default to issuezilla for the #123 variant + # but match only bug number with >= 4 digits + } elsif ( $line =~ m/(\#)(\d{4,})/ ) { + $bug_orig = $1 . $2; + $bug = "i#$2"; # match #i123# } elsif ( $line =~ m/(\#i)(\d+)(\#)/ ) { $bug_orig = $1 . $2 . $3; @@ -48,6 +53,12 @@ sub search_bugs($$$$) # bnc# is preferred over n# for novell bugs $bug =~ s/^n\#/bnc#/; + # deb# is preferred over debian# for debian bugs + $bug =~ s/^debian\#/deb#/; + # easyhack# is sometimes used for fdo# - based easy hacks + $bug =~ s/^easyhack\#/fdo#/; + # someone mistyped fdo as fd0 + $bug =~ s/^fd0\#/fdo#/; # save the bug number %{$pdata->{$piece}{$commit_id}{'bugs'}} = () if (! defined %{$pdata->{$piece}{$commit_id}{'bugs'}}); $pdata->{$piece}{$commit_id}{'bugs'}{$bug} = 1; @@ -307,15 +318,19 @@ sub get_bug_name($$) } else { print "warning: not found; using commit message\n"; } + } else { + print "\n"; } + } else { + print "\n"; } return $summary; } -sub print_bugs($$) +sub print_bugs($$$) { - my ($pdata, $log) = @_; + my ($pdata, $log, $convert_func) = @_; # associate bugs with their summaries and fixers my %bugs = (); @@ -345,7 +360,7 @@ sub print_bugs($$) $authors = " [" . join (", ", keys %{$bugs{$bug}{'author'}}) . "]"; } - printf $log $bug . " " . $summary . $authors . "\n"; + printf $log "%s %s%s\n", $convert_func->($bug), $summary, $authors; } } @@ -384,6 +399,7 @@ sub usage() " commit-log-<branch>-<log-name-suffix>.log; the branch name\n" . " is detected automatically\n" . " --bugs print just bug fixes\n" . + " --wikibugs print just bug fixes, use wiki markup\n" . " --bug-numbers print just fixed bug numbers\n" . " --rev-list use \"git rev-list\" instead of \"git log\"; useful to check\n" . " differences between branches\n" . @@ -432,6 +448,9 @@ foreach my $arg (@ARGV) { } elsif ($arg eq '--bugs') { $log_prefix = "bugfixes"; $print_mode = "bugs"; + } elsif ($arg eq '--wikibugs') { + $log_prefix = "bugfixes"; + $print_mode = "wikibugs"; } elsif ($arg eq '--bug-numbers') { $log_prefix = "bugnumbers"; $print_mode = "bugnumbers"; @@ -462,7 +481,11 @@ load_data(\%data, $top_dir, $piece, $branch_name, $git_command); $log = open_log_file($log_dir, $log_prefix, $log_suffix, $top_dir, $branch_name); if ( $print_mode eq "bugs" ) { - print_bugs(\%data, $log); + # identity-transform bug ids + print_bugs(\%data, $log, sub { return $_[0] } ); +} elsif ( $print_mode eq "wikibugs" ) { + # wiki-ize bug ids + print_bugs(\%data, $log, sub { $_[0] =~ s/(.*)\#(.*)/* {{$1|$2}}/; return $_[0] }); } elsif ( $print_mode eq "bugnumbers" ) { print_bugnumbers(\%data, $log); } else { |