From 6ad7cdc5a964c4832b30aba5fad1bc799e6c1b0b Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Wed, 13 Apr 2011 16:10:45 +0200 Subject: lo-commit-stat: add --rev-list option + use "git log" again to get weekly commit logs + use "git rev-list" only with --rev-list option; useful to list differences between branches --- bin/lo-commit-stat | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'bin/lo-commit-stat') diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat index 111127e94c2c..132b9a87bba6 100755 --- a/bin/lo-commit-stat +++ b/bin/lo-commit-stat @@ -69,9 +69,9 @@ sub standardize_summary($) sub load_git_log($$$$$) { - my ($pdata, $repo_dir, $piece, $branch_name, $pgit_args) = @_; + my ($pdata, $repo_dir, $piece, $branch_name, $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; @@ -153,7 +153,7 @@ sub get_repo_name($) sub load_data($$$$$) { - my ($pdata, $top_dir, $piece, $branch_name, $pgit_args) = @_; + my ($pdata, $top_dir, $piece, $branch_name, $git_command) = @_; if (defined $piece) { my $piece_dir; @@ -162,11 +162,11 @@ sub load_data($$$$$) } else { $piece_dir = "$top_dir/clone/$piece"; } - load_git_log($pdata, $piece_dir, $piece, $branch_name, $pgit_args); + load_git_log($pdata, $piece_dir, $piece, $branch_name, $git_command); } else { - load_git_log($pdata, $top_dir, $main_repo, $branch_name, $pgit_args); + load_git_log($pdata, $top_dir, $main_repo, $branch_name, $git_command); foreach my $piece (@pieces) { - load_git_log($pdata, "$top_dir/clone/$piece", $piece, $branch_name, $pgit_args); + load_git_log($pdata, "$top_dir/clone/$piece", $piece, $branch_name, $git_command); } } } @@ -300,7 +300,7 @@ sub usage() { print "This script generates LO git commit summary\n\n" . - "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=] --log-suffix= topdir [git_log_param...]\n\n" . + "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=] --log-suffix= topdir [git_arg...]\n\n" . "Options:\n" . " --help print this help\n" . @@ -310,11 +310,15 @@ sub usage() " commit-log--.log; the branch name\n" . " is detected autoamtically\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/ 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"; } @@ -331,6 +335,7 @@ my $log_prefix = "commit-log"; my $log_suffix; my $log; my $branch_name; +my $git_command = "git log"; my @git_args; my %data; my %print_filters = (); @@ -348,6 +353,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; @@ -357,6 +364,8 @@ foreach my $arg (@ARGV) { } } +$git_command .= " " . join ' ', @git_args if (@git_args); + (defined $top_dir) || die "Error: top direcotry 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"; @@ -365,7 +374,7 @@ foreach my $arg (@ARGV) { $branch_name = get_branch_name($top_dir); -load_data(\%data, $top_dir, $piece, $branch_name, \@git_args); +load_data(\%data, $top_dir, $piece, $branch_name, $git_command); $log = open_log_file($log_prefix, $log_suffix, $top_dir, $branch_name); print_stat(\%data, \%print_filters, $log); -- cgit v1.2.3