[Libreoffice-commits] .: bin/lo-commit-stat

2012-11-29 Thread Libreoffice Gerrit user
 bin/lo-commit-stat |   76 +++--
 1 file changed, 63 insertions(+), 13 deletions(-)

New commits:
commit 3e0e88f6751f08e3e68db48e05657f3e6b24914a
Author: Petr Mladek pmla...@suse.cz
Date:   Thu Nov 29 11:14:13 2012 +0100

lo-commit-stat: allow to filer cherry-picked commits

Add --cherry option that filters commits using the git cherry command.

Note that you need to pass git arguments for git cherry. It means
old-branch-or-tag new-branch-or-tag.

Change-Id: Iea67d0ead205c66112791cb0444fa183c7fa6e9b

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index c64e125..17ad9ff 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -6,6 +6,7 @@
 use strict;
 use LWP::UserAgent;
 use utf8;
+use File::Temp;
 
 my %module_dirname = (
 core  = ,
@@ -92,11 +93,53 @@ sub standardize_summary($)
 return $line;
 }
 
-sub load_git_log($) 
+sub generate_git_cherry_ids_log($) 
 {
-my ($pdata, $repo_dir, $module, $branch_name, $git_command) = @_;
+my ($pdata, $repo_dir, $module, $branch_name, $git_args) = @_;
+
+my $commit_ids_log;
+my $commit_ids_log_fh;
+$commit_ids_log_fh = File::Temp-new(TEMPLATE = 
'lo-commit-stat-ids-XX',
+ DIR = '/tmp',
+ UNLINK = 0);
+$commit_ids_log = $commit_ids_log_fh-filename;
+
+print STDERR Filtering cherry-picked commits in the git repo: 
$module...\n;
+
+my $cmd = cd $repo_dir; git cherry $git_args;
+open (GIT, $cmd 21|) || die Can't run $cmd: $!;
+
+while (my $line = GIT) {
+
+# skip cherry-picked commits
+next if ( $line =~ m/^\-/ );
+
+if ( $line =~ m/^\+ / ) {
+$line =~ s/^\+ //;
+print $commit_ids_log_fh $line;
+}
+}
+
+close GIT;
+close $commit_ids_log_fh;
+
+return $commit_ids_log;
+}
+
+sub load_git_log($$$) 
+{
+my ($pdata, $repo_dir, $module, $branch_name, $git_command, $git_cherry, 
$git_args) = @_;
+
+my $cmd = cd $repo_dir;;
+my $commit_ids_log;
+
+if ($git_cherry) {
+$commit_ids_log = generate_git_cherry_ids_log($pdata, $repo_dir, 
$module, $branch_name, $git_args);
+$cmd .=  cat $commit_ids_log | xargs -n 1 $git_command -1;
+} else {
+$cmd .=  $git_command $git_args;
+}
 
-my $cmd = cd $repo_dir; $git_command;
 my $commit_id;
 my $summary;
 
@@ -155,6 +198,7 @@ sub load_git_log($)
 }
 
 close GIT;
+unlink $commit_ids_log if ($git_cherry);
 }
 
 sub get_repo_name($)
@@ -176,12 +220,12 @@ sub get_repo_name($)
 die Error: can't find repo name in \$$repo_dir/.git/config\\n;
 }
 
-sub load_data($)
+sub load_data($$$)
 {
-my ($pdata, $top_dir, $p_module_dirname, $branch_name, $git_command) = @_;
+my ($pdata, $top_dir, $p_module_dirname, $branch_name, $git_command, 
$git_cherry, $git_args) = @_;
 
-foreach my $module (keys %{$p_module_dirname}) {
-load_git_log($pdata, $top_dir/$p_module_dirname-{$module}, $module, 
$branch_name, $git_command);
+foreach my $module (sort { $a cmp $b } keys %{$p_module_dirname}) {
+load_git_log($pdata, $top_dir/$p_module_dirname-{$module}, $module, 
$branch_name, $git_command, $git_cherry, $git_args);
 }
 }
 
@@ -416,12 +460,16 @@ sub usage()
--bugs-numbers  generate log with bugzilla numbers\n .
--rev-list  use \git rev-list\ instead of \git log\; 
useful to check\n .
differences between branches\n .
+   --cherryuse \git cherry\ instead of \git log\; 
detects cherry-picked\n .
+   commits between branches\n .
 topdir directory with the libreoffice/core clone\n .
 git_argextra parameters passed to the git command to 
define\n .
the area of interest; The default command is 
\git log\ and\n .
parameters might be, for example, 
--after=\2010-09-27\ or\n .
TAG..HEAD; with the option --rev-list, useful 
might be, for\n .
-   example origin/master 
^origin/libreoffice-3-3\n;
+   example origin/master ^origin/libreoffice-3-3; 
with the option\n .
+   --rev-list, useful might be, for example 
libreoffice-3.6.3.2\n .
+   libreoffice-3.6.4.1\n;
 }
 
 
@@ -441,8 +489,9 @@ my $log_suffix;
 my $log;
 my $branch_name;
 my $git_command = git log;
+my $git_cherry;
+my $git_args = ;
 my $branch_name;
-my @git_args;
 my %data;
 my $print_mode = normal;
 
@@ -477,11 +526,14 @@ foreach my $arg (@ARGV) {
 $generate_log{bugs-numbers} = 1;
 } elsif ($arg eq '--rev-list') {
 $git_command = git rev-list --pretty=medium
+} elsif ($arg eq 

[Libreoffice-commits] .: bin/lo-commit-stat

2012-11-19 Thread Libreoffice Gerrit user
 bin/lo-commit-stat |  144 ++---
 1 file changed, 73 insertions(+), 71 deletions(-)

New commits:
commit 0746c95f260c0b722547e760c28cd0daecc8ceba
Author: Petr Mladek pmla...@suse.cz
Date:   Mon Nov 19 17:50:42 2012 +0100

lo-commit-stat: make it working with git submodules

renamed options:
--no-piece to --no-submodule
--piece=piece to --module=module

Change-Id: Ic4f1e3f4bdbe4f4fc175fea82e670310753ce130

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 81aa700..910d4ad 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -7,8 +7,13 @@ use strict;
 use LWP::UserAgent;
 use utf8;
 
-my $main_repo=core;
-my @pieces=(dictionaries, help, translations);
+my %module_dirname = (
+core  = ,
+dictionaries  = dictionaries,
+help  = helpcontent2,
+translations  = translations
+);
+
 
 my %bugzillas = (
 fdo  = https://bugs.freedesktop.org/show_bug.cgi?id=;,
@@ -20,7 +25,7 @@ my %bugzillas = (
 
 sub search_bugs()
 {
-my ($pdata, $piece, $commit_id, $line) = @_;
+my ($pdata, $module, $commit_id, $line) = @_;
 
 my $bug = ;
 my $bug_orig;
@@ -61,8 +66,8 @@ sub search_bugs()
 # 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;
+%{$pdata-{$module}{$commit_id}{'bugs'}} = () if (! defined 
%{$pdata-{$module}{$commit_id}{'bugs'}});
+$pdata-{$module}{$commit_id}{'bugs'}{$bug} = 1;
 }
 
 return $line;
@@ -89,23 +94,24 @@ sub standardize_summary($)
 
 sub load_git_log($) 
 {
-my ($pdata, $repo_dir, $piece, $branch_name, $git_command) = @_;
+my ($pdata, $repo_dir, $module, $branch_name, $git_command) = @_;
 
 my $cmd = cd $repo_dir; $git_command;
 my $commit_id;
 my $summary;
 
-print STDERR Analyzing log from the git repo: $piece...\n;
+print STDERR Analyzing log from the git repo: $module...\n;
 
-my $repo_branch_name = get_branch_name($repo_dir);
-if ( $branch_name ne $repo_branch_name ) {
-die Error: mismatch of branches:\n .
-   main repo is on the branch: $branch_name\n .
-   $piece repo is on the branch: $repo_branch_name\n;
-}
+#   FIXME: ./g pull move submodules in unnamed branches
+#my $repo_branch_name = get_branch_name($repo_dir);
+#if ( $branch_name ne $repo_branch_name ) {
+#die Error: mismatch of branches:\n .
+#   main repo is on the branch: $branch_name\n .
+#   $module repo is on the branch: $repo_branch_name\n;
+#}
 
 open (GIT, $cmd 21|) || die Can't run $cmd: $!;
-%{$pdata-{$piece}} = ();
+%{$pdata-{$module}} = ();
 
 while (my $line = GIT) {
 chomp $line;
@@ -113,7 +119,7 @@ sub load_git_log($)
 if ( $line =~ m/^commit ([0-9a-z]{20})/ ) {
 $commit_id = $1;
 $summary=undef;
-%{$pdata-{$piece}{$commit_id}} = ();
+%{$pdata-{$module}{$commit_id}} = ();
 next;
 }
 
@@ -121,10 +127,10 @@ sub load_git_log($)
 # get rid of extra empty spaces;
 my $name = $1;
 $name =~ s/\s+$//;
-die Error: Author already defined for the commit {$commit_id}\n 
if defined ($pdata-{$piece}{$commit_id}{'author'});
-%{$pdata-{$piece}{$commit_id}{'author'}} = ();
-$pdata-{$piece}{$commit_id}{'author'}{'name'} = $name;
-$pdata-{$piece}{$commit_id}{'author'}{'email'} = $2;
+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;
 next;
 }
 
@@ -138,13 +144,13 @@ sub load_git_log($)
 next;
 }
 
-$line = search_bugs($pdata, $piece, $commit_id, $line);
+$line = search_bugs($pdata, $module, $commit_id, $line);
 # FIXME: need to be implemented
 #search_keywords($pdata, $line);
 
-unless (defined $pdata-{$piece}{$commit_id}{'summary'}) {
+unless (defined $pdata-{$module}{$commit_id}{'summary'}) {
 $summary = standardize_summary($line);
-$pdata-{$piece}{$commit_id}{'summary'} = $summary;
+$pdata-{$module}{$commit_id}{'summary'} = $summary;
 }
 }
 
@@ -172,21 +178,10 @@ sub get_repo_name($)
 
 sub load_data($)
 {
-my ($pdata, $top_dir, $piece, $branch_name, $git_command) = @_;
+my ($pdata, $top_dir, $p_module_dirname, $branch_name, $git_command) = @_;
 
-if (defined $piece) {
-my 

[Libreoffice-commits] .: bin/lo-commit-stat

2012-07-11 Thread Thorsten Behrens
 bin/lo-commit-stat |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 724b4eab1abaab12f42fda051e1408c97891868a
Author: Thorsten Behrens tbehr...@suse.com
Date:   Thu Jul 12 01:32:55 2012 +0200

Make commit stat script recognize opensuse fate entries, too

Change-Id: Ia6b3e6459c5bda7ea24091024cf3dabd19746237

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 4fb8a10..4135b8b 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -11,10 +11,11 @@ my $main_repo=core;
 my @pieces=(binfilter, dictionaries, help, translations);
 
 my %bugzillas = (
-fdo  = https://bugs.freedesktop.org/;,
-bnc  = https://bugzilla.novell.com/;,
-rhbz = https://bugzilla.redhat.com/;,
-i= https://issues.apache.org/ooo/;,
+fdo  = https://bugs.freedesktop.org/show_bug.cgi?id=;,
+bnc  = https://bugzilla.novell.com/show_bug.cgi?id=;,
+rhbz = https://bugzilla.redhat.com/show_bug.cgi?id=;,
+i= https://issues.apache.org/ooo/show_bug.cgi?id=;,
+fate = https://features.opensuse.org/;,
 );
 
 sub search_bugs()
@@ -305,7 +306,7 @@ sub get_bug_name($$)
 my $bug_number = $2;  # 12345
 
 if ( $bugzillas{$bugzilla} ) {
-my $url = $bugzillas{$bugzilla} . show_bug.cgi?id= . $bug_number;
+my $url = $bugzillas{$bugzilla} . $bug_number;
 my $ua = LWP::UserAgent-new;
 $ua-timeout(10);
 $ua-env_proxy;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: bin/lo-commit-stat

2012-06-25 Thread Thorsten Behrens
 bin/lo-commit-stat |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 418df9282d772d21eebb56f858fd84036d9b691a
Author: Thorsten Behrens tbehr...@suse.com
Date:   Sat Jun 23 16:08:10 2012 +0200

Slightly more robust removal of bug title prefix.

Change-Id: Ic37589222831d03ec48689a077b1eb16a9199385

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index d2b6d85..4fb8a10 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -312,11 +312,11 @@ sub get_bug_name($$)
 my $response = $ua-get($url);
 if ($response-is_success) {
 my $title = $response-title;
-if ( $title =~ s/^Bug \d+ – // ) {
+if ( $title =~ s/^Bug \d+ \S+ // ) {
 print $title\n;
 return $title;
 } else {
-print warning: not found; using commit message\n;
+print warning: not found; using commit message (only got 
$title)\n;
 }
 } else {
 print \n;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: bin/lo-commit-stat

2012-06-13 Thread Thorsten Behrens
 bin/lo-commit-stat |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit d5e3a6ae448952e71174954671d1cd790f2d0b50
Author: Thorsten Behrens tbehr...@suse.com
Date:   Wed Jun 13 11:20:47 2012 +0200

No need for fancy string formatting, use plain print

Change-Id: I6886664951e76ce66c991f3657751f79e7896f0b

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 1a8e6bb..d6b7846 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -80,9 +80,6 @@ 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
@@ -246,7 +243,7 @@ sub print_summary_in_stat($$)
 
 # print piece title if not done yet
 if ( defined ${$ppiece_title} ) {
-printf $log ${$ppiece_title}\n;
+print $log, ${$ppiece_title}\n;
 ${$ppiece_title} = undef;
 }
 
@@ -261,7 +258,7 @@ sub print_summary_in_stat($$)
 $authors =  [ . join (, , keys %{$pauthors}) . ];
 }
 
-printf $log $prefix . $summary . $bugs . $authors . \n;
+print $log $prefix, $summary, $bugs, $authors, \n;
 }
 
 sub print_stat($$)
@@ -363,7 +360,7 @@ sub print_bugs($$$)
 $authors =  [ . join (, , keys %{$bugs{$bug}{'author'}}) . ];
 }
 
-printf $log %s %s%s\n, $convert_func-($bug), $summary, $authors;
+print $log $convert_func-($bug),  , $summary, $authors, \n;
 }
 }
 
@@ -381,7 +378,7 @@ sub print_bugnumbers($$)
 }
 }
 
-printf $log join (\n, sort { $a cmp $b } keys %bugs) . \n;
+print $log join (\n, sort { $a cmp $b } keys %bugs), \n;
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: bin/lo-commit-stat

2012-06-11 Thread Thorsten Behrens
 bin/lo-commit-stat |   35 +--
 1 file changed, 29 insertions(+), 6 deletions(-)

New commits:
commit 9852f01df91cdf5bb5ac924d2354eac8a6481df7
Author: Thorsten Behrens tbehr...@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

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 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: bin/lo-commit-stat

2012-05-21 Thread Petr Mladek
 bin/lo-commit-stat |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 521ae23254b6fbf45d27cc76354bc774a453baf7
Author: Ivan Timofeev timofeev@gmail.com
Date:   Mon May 21 16:54:25 2012 +0200

lo-commit-stat: use utf8 to be able to query a dash in the bug title

Change-Id: I691616575b5ea0b35e0ec0cc98db6772a7ad3b25

diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index a61b326..1572924 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -5,6 +5,7 @@
 
 use strict;
 use LWP::UserAgent;
+use utf8;
 
 my $main_repo=core;
 my @pieces=(binfilter, dictionaries, help, translations);
@@ -297,7 +298,7 @@ sub get_bug_name($$)
 my $response = $ua-get($url);
 if ($response-is_success) {
 my $title = $response-title;
-if ( $title =~ s/^Bug \d+ . // ) {
+if ( $title =~ s/^Bug \d+ – // ) {
 print $title\n;
 return $title;
 } else {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits