[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - bin/lo-commit-stat

Petr Mladek pmladek at kemper.freedesktop.org
Tue Jun 12 11:13:59 PDT 2012


 bin/lo-commit-stat |   38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

New commits:
commit eeeffb9a9d8e1a84d2d85a13ea84e9d00aed3e58
Author: Petr Mladek <pmladek at suse.cz>
Date:   Tue Jun 12 19:46:42 2012 +0200

    lo-commit-stat: avoid problems whit '%' in the commit message
    
    Change-Id: Ia10bac649cc078f6ef39002d280dcff7e5d0b06d

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 310548e..1a8e6bb 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -80,6 +80,9 @@ sub standardize_summary($)
         my $first_char = lc($1);
         $line =~ s/^./$first_char/;
     }
+    # print does not like 0% or so
+    $line =~ s/%/%%/g;
+    
 
     # FIXME: remove do at the end of line
     #        remove bug numbers
commit 0fb4d677b32d944c8796d71ae95a7f41cc47e16c
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Jun 12 03:34:33 2012 +0200

    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
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 0697432..310548e 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 {


More information about the Libreoffice-commits mailing list