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

Christian Lohmaier lohmaier+LibreOffice at googlemail.com
Wed Aug 2 10:10:19 UTC 2017


 bin/lo-commit-stat |   36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

New commits:
commit 7193a4a1a0df775a0eb2ef222871d46b3c8b92b0
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Sat Apr 29 19:15:26 2017 +0200

    lo-commit-stat: use matching group before destroying it with another match
    
    it also doesn't make sense to numerically compare a %hash
    enable warnings in the script and remove a duplicated variable (and
    some unnecessary hash-declarations)
    
    Change-Id: I0a84dc28f369931ee31a1cf12849fde2b63f1ca2
    (cherry picked from commit 249b6a552b00637ae7ad3dcb8d797befba1734ad)

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 4ad9f013935f..2e42d468b40d 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -4,6 +4,7 @@
 #!/usr/bin/perl
 
 use strict;
+use warnings;
 use LWP::UserAgent;
 use utf8;
 use File::Temp;
@@ -157,26 +158,24 @@ sub load_git_log($$$$$$$)
 #    }
 
     open (GIT, "$cmd 2>&1|") || die "Can't run $cmd: $!";
-    %{$pdata->{$module}} = ();
 
     while (my $line = <GIT>) {
         chomp $line;
 
         if ( $line =~ m/^commit ([0-9a-z]{20})/ ) {
-            $commit_id = "$1";
+            $commit_id = $1;
             $summary=undef;
-            %{$pdata->{$module}{"$commit_id"}} = ();
             next;
         }
 
         if ( $line =~ /^Author:\s*([^\<]*)\<([^\>]*)>/ ) {
             # get rid of extra empty spaces;
-            my $name = "$1";
+            my $name = $1;
+            my $email = $2;
             $name =~ s/\s+$//;
             die "Error: Author already defined for the commit {$commit_id}\n" if defined ($pdata->{$module}{$commit_id}{'author'});
-            %{$pdata->{$module}{$commit_id}{'author'}} = ();
-            $pdata->{$module}{$commit_id}{'author'}{'name'} = "$name";
-            $pdata->{$module}{$commit_id}{'author'}{'email'} = "$2";
+            $pdata->{$module}{$commit_id}{'author'}{'name'} = $name;
+            $pdata->{$module}{$commit_id}{'author'}{'email'} = $email;
             next;
         }
 
@@ -506,7 +505,6 @@ my $branch_name;
 my $git_command = "git log";
 my $git_cherry;
 my $git_args = "";
-my $branch_name;
 my %data;
 my %bugs = ();
 
@@ -555,7 +553,7 @@ foreach my $arg (@ARGV) {
 }
 
 # default log
-if (%generate_log == 0) {
+unless (%generate_log) {
     $generate_log{"commits"} = 1;
 }
 
commit 5f9da269510ea81bc346aba7364dc39f5e42a5fd
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Sat Apr 29 18:54:16 2017 +0200

    lo-commit-stat: improve sort in buglists (by number within a tracker)
    
    Change-Id: I8eb5a3d3141fcc76bf5caffe0a7b30d5ec2b0c8c
    (cherry picked from commit 0b8cccdc20f7e9209de406ee1ec01aec8bfafceb)

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index ca3aa638644b..4ad9f013935f 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -402,7 +402,9 @@ sub print_bugs($$$$)
 {
     my ($pbugs, $log, $wiki) = @_;
 
-    foreach my $bug ( sort { $a cmp $b } keys %{$pbugs}) {
+    # sort alphabetically by bugzilla-type, but whithin that numerically
+    foreach my $bug ( sort { ($a =~ /(\D+)/)[0] cmp ($b =~ /(\D+)/)[0] ||
+                             ($a =~ /(\d+)/)[0] <=> ($b =~ /(\d+)/)[0] } keys %{$pbugs}) {
         my $summary = $pbugs->{$bug}{'summary'};
 
         my $authors = "";
commit cbd3c09e29df72a05025c117def44fbcc1163f20
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Sat Apr 29 18:26:20 2017 +0200

    lo-commit-stat: default to utf8, adjust regex for tdf bugzilla
    
    Change-Id: I61960512e297417eb096b3bc921974aa43f74ccc
    (cherry picked from commit 9c83796f45e634afd770b772a16209e1dbed7068)

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index a4e3f7d1ae32..ca3aa638644b 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -7,6 +7,9 @@ use strict;
 use LWP::UserAgent;
 use utf8;
 use File::Temp;
+use Encode;
+use open ':encoding(utf8)';
+use open ':std' => ':encoding(utf8)';
 
 my %module_dirname = (
     "core"              => "",
@@ -381,19 +384,16 @@ sub get_bug_name($$)
         $ua->env_proxy;
         my $response = $ua->get($url);
         if ($response->is_success) {
-            my $title = $response->title;
-            if ( $title =~ s/^Bug \d+ \S+ // ) {
+            my $title = decode('utf8', $response->title);
+            if ( $title =~ s/^(?:Bug $bug_number \S+|$bug_number –) // ) {
                 print "$title\n";
                 return $title;
             } else {
-                print "warning: not found; using commit message (only got $title)\n";
+                print "warning: not found; using commit message (only got $title)";
             }
-        } else {
-            print "\n";
         }
-    } else {
-        print "\n";
     }
+    print "\n";
 
     return $summary;
 }
commit 39092ed597bbe3653638736f61748843ddc1cc99
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Sat Apr 29 17:00:09 2017 +0200

    lo-commit-stat: drop unnecessary check whether hash is defined
    
    besides using deprecated syntax – "if (defined %hash)" (or "if (defined
    @array)" for that matter) – just using "if (%hash)" (or "if (@array)")
    would do, it is also unnecessary to create the hash if it doesn't exist
    (autovivification will take care of that)
    
    Change-Id: Ib5704b2d609ae3658f3c166f9e26a051957149f8
    (cherry picked from commit 146258f82fc15d0a5f8779447a4919429496e9e3)

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index e33ca798f41e..a4e3f7d1ae32 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -68,7 +68,6 @@ sub search_bugs($$$$)
         # someone mistyped fdo as fd0
         $bug =~ s/^fd0\#/fdo#/;
         # save the bug number
-        %{$pdata->{$module}{$commit_id}{'bugs'}} = () if (! defined %{$pdata->{$module}{$commit_id}{'bugs'}});
         $pdata->{$module}{$commit_id}{'bugs'}{$bug} = 1;
     }
 
@@ -262,7 +261,6 @@ sub get_bug_list($$$)
     foreach my $module ( keys %{$pdata}) {
         foreach my $id ( keys %{$pdata->{$module}}) {
             foreach my $bug (keys %{$pdata->{$module}{$id}{'bugs'}}) {
-                %{$pbugs->{$bug}} = () if (! defined %{$pbugs->{$bug}});
                 my $author = $pdata->{$module}{$id}{'author'}{'name'};
                 my $summary = $pdata->{$module}{$id}{'summary'};
                 $pbugs->{$bug}{'summary'} = $summary;


More information about the Libreoffice-commits mailing list