Produce needed output by script.

Include some verbosity too.
This commit is contained in:
Bradley M. Kuhn 2016-04-28 15:06:55 -07:00
parent 214908d552
commit 80da332beb

View file

@ -30,17 +30,24 @@
use Git::Repository 'Log'; use Git::Repository 'Log';
if (@ARGV != 2) { if (@ARGV != 3 and @ARGV != 2 and @ARGV != 4) {
print "usage: $0 <GIT_REPOSITORY_PATH> ", "<NAME_REGEX>\n"; print "usage: $0 <GIT_REPOSITORY_PATH> ", "<AUTHOR_NAME_REGEX> [<LOG_MESSAGE_REGEX>] [<VERBOSE_LEVEL>]\n";
exit 1; exit 1;
} }
my($GIT_REPOSITORY_PATH, $NAME_REGEX) = @ARGV; my($GIT_REPOSITORY_PATH, $AUTHOR_NAME_REGEX, $LOG_MESSAGE_REGEX, $VERBOSE) = @ARGV;
$VERBOSE = 0 if not defined $VERBOSE;
my $gitRepository = Git::Repository->new(git_dir => $GIT_REPOSITORY_PATH); my $gitRepository = Git::Repository->new(git_dir => $GIT_REPOSITORY_PATH);
my $logIterator = $gitRepository->log(); my $logIterator = $gitRepository->log();
while ( my $gitLog = $logIterator->next() ) { while ( my $gitLog = $logIterator->next() ) {
print ref $gitLog, "\n"; my $author = $gitLog->author();
my $message = $gitLog->message();
if ($author =~ /$AUTHOR_NAME_REGEX/im or (defined $LOG_MESSAGE_REGEX and $message =~ /$LOG_MESSAGE_REGEX/im)) {
print STDERR "Including: ", $gitLog->commit(), "\n", "Author: $author", "\n\n", $message, "#" x 72, "\n"
if $VERBOSE;
}
print $gitLog->commit(), "\n";
} }
# #