Progress option and use of it.

This commit is contained in:
Bradley M. Kuhn 2016-04-29 12:32:42 -07:00
parent 675cd0a98b
commit cc10317ec7

View file

@ -92,14 +92,15 @@ use POSIX qw(strftime);
use Getopt::Long;
use Pod::Usage;
my($GIT_REPOSITORY_PATH, $OUTPUT_DIRECTORY, $CENTRAL_COMMIT, $FORK_LIMIT, $VERBOSE, @ADDITIONAL_BLAME_OPTS);
$VERBOSE = 0;
my($GIT_REPOSITORY_PATH, $OUTPUT_DIRECTORY, $CENTRAL_COMMIT, $FORK_LIMIT, $PROGRESS, $VERBOSE, @ADDITIONAL_BLAME_OPTS);
$PROGRESS = $VERBOSE = 0;
$FORK_LIMIT = 1;
my $usage = "usage: $0 --repository=PATH --output-dir=DIR [--central-commit=COMMIT-ID] [--fork-limit=NUMBER [--verbose[=LEVEL]]\n";
my $usage = "usage: $0 --repository=PATH --output-dir=DIR [--central-commit=COMMIT-ID] [--fork-limit=NUMBER [--progress] [--verbose[=LEVEL]]\n";
unless (GetOptions("repository=s" => \$GIT_REPOSITORY_PATH,
"output-dir=s" => \$OUTPUT_DIRECTORY,
"verbose:+" => \$VERBOSE,
"progress" => \$PROGRESS,
"--blame-opts=s" => \@ADDITIONAL_BLAME_OPTS,
"central-commit:s" => \$CENTRAL_COMMIT,
"fork-limit:i" => \$FORK_LIMIT)) {
@ -220,7 +221,12 @@ sub RunCentralCommitMode($) {
}
}
$SIG{CHLD} = $HANDLE_BLAME_WORKERS_SUB;
my $cnt = scalar(keys %files);
print STDERR "Git blame operations to complete: $cnt\n" if $PROGRESS;
foreach my $file (keys %files) {
if ($PROGRESS) {
print STDERR "."; $cnt--; if ($cnt % 100 == 0) { print "\nOperations Remaining: $cnt\n"; }
}
my($vv, $path, $filename) = File::Spec->splitpath($file);
$path = File::Spec->catfile($centralOutputDir, $path);
make_path($path, 0750);