summaryrefslogtreecommitdiff
path: root/bin/lo-commit-stat
diff options
context:
space:
mode:
Diffstat (limited to 'bin/lo-commit-stat')
-rwxr-xr-xbin/lo-commit-stat45
1 files changed, 27 insertions, 18 deletions
diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat
index 5cc772fa7f23..51029fff25cd 100755
--- a/bin/lo-commit-stat
+++ b/bin/lo-commit-stat
@@ -39,7 +39,7 @@ sub search_bugs($$$$)
$line =~ s/\s*-\s*$bug_orig\s*//;
$line =~ s/\(?$bug_orig\)?[:,]?\s*//;
- # bnc# is prefered over n# for novell bugs
+ # bnc# is preferred over n# for novell bugs
$bug =~ s/^n\#/bnc#/;
# save the bug number
%{$pdata->{$piece}{$commit_id}{'bugs'}} = () if (! defined %{$pdata->{$piece}{$commit_id}{'bugs'}});
@@ -69,9 +69,9 @@ sub standardize_summary($)
sub load_git_log($$$$)
{
- my ($pdata, $repo_dir, $piece, $pgit_args) = @_;
+ my ($pdata, $repo_dir, $piece, $git_command) = @_;
- my $cmd = "cd $repo_dir && git rev-list --pretty=medium " . join ' ', @{$pgit_args};
+ my $cmd = "cd $repo_dir; $git_command";
my $commit_id;
my $summary;
@@ -113,7 +113,7 @@ sub load_git_log($$$$)
}
$line = search_bugs($pdata, $piece, $commit_id, $line);
- # FIXME: need to be implemeted
+ # FIXME: need to be implemented
# search_keywords($pdata, $line);
unless (defined $pdata->{$piece}{$commit_id}{'summary'}) {
@@ -146,7 +146,7 @@ sub get_repo_name($)
sub load_data($$$$)
{
- my ($pdata, $top_dir, $piece, $pgit_args) = @_;
+ my ($pdata, $top_dir, $piece, $git_command) = @_;
if (defined $piece) {
my $piece_dir;
@@ -155,11 +155,11 @@ sub load_data($$$$)
} else {
$piece_dir = "$top_dir/clone/$piece";
}
- load_git_log($pdata, $piece_dir, $piece, $pgit_args);
+ load_git_log($pdata, $piece_dir, $piece, $git_command);
} else {
- load_git_log($pdata, $top_dir, $main_repo, $pgit_args);
+ load_git_log($pdata, $top_dir, $main_repo, $git_command);
foreach my $piece (@pieces) {
- load_git_log($pdata, "$top_dir/clone/$piece", $piece, $pgit_args);
+ load_git_log($pdata, "$top_dir/clone/$piece", $piece, $git_command);
}
}
}
@@ -201,7 +201,7 @@ sub open_log_file($$$)
if (-f $logfilename) {
print "WARNING: The log file already exists: $logfilename\n";
- print "Do you want to ovewrite it? (Y/n)?\n";
+ print "Do you want to overwrite it? (Y/n)?\n";
my $answer = <STDIN>;
chomp $answer;
$answer = "y" unless ($answer);
@@ -256,7 +256,7 @@ sub print_stat($$$)
my ($pdata, $pprint_filters, $log) = @_;
foreach my $piece ( sort { $a cmp $b } keys %{$pdata}) {
- # check if this peice has any entries at all
+ # check if this piece has any entries at all
my $piece_title = "+ $piece";
if ( %{$pdata->{$piece}} ) {
my $old_summary="";
@@ -298,21 +298,25 @@ sub usage()
{
print "This script generates LO git commit summary\n\n" .
- "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=<piece>] --log-suffix=<string> topdir [git_log_param...]\n\n" .
+ "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=<piece>] --log-suffix=<string> topdir [git_arg...]\n\n" .
"Options:\n" .
" --help print this help\n" .
" --no-pieces read changes just from the main repository, ignore other cloned repos\n" .
- " --piece=<piece> summarize just chnages from the given piece\n" .
+ " --piece=<piece> summarize just changes from the given piece\n" .
" --log-suffix=<string> suffix of the log file name; the result will be\n" .
" commit-log-<branch>-<log-name-suffix>.log; the branch name\n" .
- " is detected autoamtically\n" .
+ " is detected automatically\n" .
" --bugs print just bug fixes\n" .
+ " --rev-list use \"git rev-list\" instead of \"git log\"; useful to check\n" .
+ " differences between branches\n" .
" topdir directory with the libreoffice/bootstrap clone; the piece repos\n" .
" must be cloned in the main-repo-root/clone/<piece> subdirectories\n" .
- " git_log_param extra parameters passed to the git log command to define\n" .
- " the area of interest , e.g. --after=\"2010-09-27\" or\n" .
- " TAG..HEAD or origin/master ^origin/libreoffice-3-3";
+ " git_arg extra 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";
}
@@ -328,6 +332,7 @@ my $top_dir;
my $log_prefix = "commit-log";
my $log_suffix;
my $log;
+my $git_command = "git log";
my @git_args;
my %data;
my %print_filters = ();
@@ -345,6 +350,8 @@ foreach my $arg (@ARGV) {
} elsif ($arg eq '--bugs') {
$print_filters{'bug'} = 1;
$log_prefix = "bugfixes"
+ } elsif ($arg eq '--rev-list') {
+ $git_command = "git rev-list --pretty=medium"
} else {
if (! defined $top_dir) {
$top_dir=$arg;
@@ -354,13 +361,15 @@ foreach my $arg (@ARGV) {
}
}
-(defined $top_dir) || die "Error: top direcotry is not defined\n";
+$git_command .= " " . join ' ', @git_args if (@git_args);
+
+(defined $top_dir) || die "Error: top directory is not defined\n";
(-d "$top_dir") || die "Error: not a directory: $top_dir\n";
(-f "$top_dir/.git/config") || die "Error: can't find $top_dir/.git/config\n";
(defined $log_suffix) || die "Error: define log suffix using --log-suffix=<string>\n";
-load_data(\%data, $top_dir,$piece, \@git_args);
+load_data(\%data, $top_dir,$piece, $git_command);
$log = open_log_file($log_prefix, $log_suffix, $top_dir);
print_stat(\%data, \%print_filters, $log);