Kaydet (Commit) dd15b51d authored tarafından Petr Mladek's avatar Petr Mladek

lo-commit-stat: problem with wide character in bug title

+ do not check for "-" in the bug title; it might be also wide character
  in some cases

+ show result when looking for bug titles

+ sort bugs when loolking for bug titles and printing bug numbers

Change-Id: I39496f7d0cf5f7a116e7d3c506b76b4a3de1dee1
üst b4721360
...@@ -283,7 +283,7 @@ sub print_stat($$) ...@@ -283,7 +283,7 @@ sub print_stat($$)
sub get_bug_name($$) sub get_bug_name($$)
{ {
my ($bug, $summary) = @_; my ($bug, $summary) = @_;
print "$bug\n"; print "$bug: ";
$bug =~ m/(?:(\w*)\#+(\d+))/; # fdo#12345 $bug =~ m/(?:(\w*)\#+(\d+))/; # fdo#12345
my $bugzilla = $1; # fdo my $bugzilla = $1; # fdo
...@@ -296,9 +296,12 @@ sub get_bug_name($$) ...@@ -296,9 +296,12 @@ sub get_bug_name($$)
$ua->env_proxy; $ua->env_proxy;
my $response = $ua->get($url); my $response = $ua->get($url);
if ($response->is_success) { if ($response->is_success) {
my $title = $response->title(); my $title = $response->title;
if ( $title =~ s/^Bug \d+ – // ) { if ( $title =~ s/^Bug \d+ . // ) {
print "$title\n";
return $title; return $title;
} else {
print "warning: not found; using commit message\n";
} }
} }
} }
...@@ -324,7 +327,8 @@ sub print_bugs($$) ...@@ -324,7 +327,8 @@ sub print_bugs($$)
} }
# try to replace summaries with bug names from bugzilla # try to replace summaries with bug names from bugzilla
foreach my $bug ( keys %bugs) { print "Getting bug titles:\n";
foreach my $bug ( sort { $a cmp $b } keys %bugs) {
$bugs{$bug}{'summary'} = get_bug_name($bug, $bugs{$bug}{'summary'}); $bugs{$bug}{'summary'} = get_bug_name($bug, $bugs{$bug}{'summary'});
} }
...@@ -355,7 +359,7 @@ sub print_bugnumbers($$) ...@@ -355,7 +359,7 @@ sub print_bugnumbers($$)
} }
} }
printf $log join ("\n", keys %bugs) . "\n"; printf $log join ("\n", sort { $a cmp $b } keys %bugs) . "\n";
} }
######################################################################## ########################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment