sub search_bugs($$$$)
{
my ($pdata, $module, $commit_id, $line) = @_;
my $bug = "";
my $bug_orig; while (defined $bug) {
# match fdo#123, rhz#123, i#123, #123 # but match only bug number with >= 4 digits 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 #i123java.lang.NullPointerException
} elsif ( $line =~ m/(\#i)(\d+)(\#)/ ) {
$bug_orig = $1 . $2 . $3;
$bug = "i#$2";
} else {
$bug = undef;
next;
}
# print " found $bug\n"; # remove bug number from the comment; it will be added later a standardized way
$bug_orig =~ s/\#/\\#/;
$line =~ s/(,\s)*[Rr](elated|esolve[ds]):?\s*$bug_orig\s?:?\s*//;
$line =~ s/\s*-\s*$bug_orig\s*//;
$line =~ s/\(?$bug_orig\)?\s*[:,-]?\s*//;
# 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->{$module}{$commit_id}{'bugs'}{$bug} = 1;
}
return $line;
}
sub standardize_summary($)
{
my $line = shift;
$line =~ s/^\s*//;
$line =~ s/\s*$//;
# lower first letter if the word contains only lowercase letter if ( $line =~ m/(^.[a-z]+\b)/ ) {
$line =~ m/(^.)/;
my $first_char = lc($1);
$line =~ s/^./$first_char/;
}
# FIXME: remove do at the end of line # remove bug numbers return $line;
}
sub generate_git_cherry_ids_log($$$$$)
{
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-XXXXXX',
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 2>&1|") || die "Can't run $cmd: $!";
while (my $line = <GIT>) {
# skip cherry-picked commits
next if ( $line =~ m/^\-/ );
print STDERR "Analyzing log from the git repo: $module...\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 2>&1|") || die "Can't run $cmd: $!";
if ( $line =~ /^Author:\s*([^\<]*)\<([^\>]*)>/ ) { # get rid of extra empty spaces;
my $name = $1;
my $email = $2;
$name =~ s/\s+$//;
die "Error: Author already defined for the commit {$commit_id}\n"ifdefined ($pdata->{$module}{$commit_id}{'author'});
$pdata->{$module}{$commit_id}{'author'}{'name'} = $name;
$pdata->{$module}{$commit_id}{'author'}{'email'} = $email;
next;
}
if ( $line =~ /^Date:\s+/ ) { # ignore date line
next;
}
if ( $line =~ /^\s*$/ ) { # ignore empty line
next;
}
unless (defined $pdata->{$module}{$commit_id}{'summary'}) {
$line = search_bugs($pdata, $module, $commit_id, $line); # FIXME: need to be implemented # search_keywords($pdata, $line);
if (-f $logfilename) {
print "WARNING: The log file already exists: $logfilename\n";
print "Do you want to overwrite it? (Y/n)?\n";
my $answer = <STDIN>;
chomp $answer;
$answer = "y" unless ($answer);
die "Please, rename the file or choose another log suffix\n"if ( lc($answer) ne "y" );
}
my $log;
open($log, '>', $logfilename) || die "Can't open \"$logfilename\" for writing: $!\n";
return $log;
}
sub print_commit_summary($$$$$$)
{
my ($summary, $pmodule_title, $pbugs, $pauthors, $prefix, $log) = @_;
returnif ( $summary eq "" );
# print module title ifnot done yet if ( defined ${$pmodule_title} ) {
print $log "${$pmodule_title}\n";
${$pmodule_title} = undef;
}
# finally print the summary line
my $bugs = ""; if ( %{$pbugs} ) {
$bugs = " (" . join (", ", keys %{$pbugs}) . ")";
}
"Options:\n" . " --help print this help\n" . " --no-submodule read changes just from the main repository, ignore submodules\n" . " --module=<module> summarize just changes from the given module, use \"core\"\n" . " for the main module\n" . " --log-dir=<dir> directory where to put the generated log\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 automatically\n" . " --commits generate log with all commits (default)\n" . " --bugs generate log with bugzilla entries\n" . " --bugs-changelog generate log with bugzilla entries, use changelog style\n" . " --bugs-wiki generate log with bugzilla entries, use wiki markup\n" . " --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" . " --cherry use \"git cherry\" instead of \"git log\"; detects cherry-picked\n" . " commits between branches\n" . " topdir directory with the libreoffice/core clone\n" . " 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; with the option\n" . " --rev-list, useful might be, for example libreoffice-3.6.3.2\n" . " libreoffice-3.6.4.1\n";
}
######################################################################java.lang.NullPointerException ######################################################################java.lang.NullPointerException # MAIN ######################################################################java.lang.NullPointerException ######################################################################java.lang.NullPointerException
my $module;
my %generate_log = ();
my $top_dir;
my $log_dir;
my $log_suffix;
my $log;
my $list_bugs = 0;
my $check_bugzilla = 0;
my $branch_name;
my $git_command = "git log";
my $git_cherry;
my $git_args = "";
my %data;
my %bugs = ();
# we want only one module if ($module) {
my $name = $module_dirname{$module};
%module_dirname = ();
$module_dirname{$module} = $name;
}
(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_dir) || (-d $log_dir) || die "Error: directory does no exist: $log_dir\n";
(defined $log_suffix) || die "Error: define log suffix using --log-suffix=<string>\n";
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.