From ab33daa5d87bf8aa70ee0f53a61ed2343ed5751c Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Mon, 2 May 2016 08:47:22 -0700 Subject: [PATCH] Create a separate comprehensive mode --- extract-code-added-in-commits.plx | 36 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/extract-code-added-in-commits.plx b/extract-code-added-in-commits.plx index 2cebd11..2e414ed 100755 --- a/extract-code-added-in-commits.plx +++ b/extract-code-added-in-commits.plx @@ -269,23 +269,16 @@ sub RunCentralCommitMode($) { } } ############################################################################## -# Main line of script - -if (defined $CENTRAL_COMMIT) { - RunCentralCommitMode($CENTRAL_COMMIT); -} - -exit 0; - -foreach my $commitId (keys %WHITELIST_COMMIT_IDS) { - my $remainingCount = scalar(keys %childProcesses); - while ($remainingCount >= $FORK_LIMIT) { - print STDERR "Sleep a bit while $remainingCount children going for these commits ", - join(", ", sort values %childProcesses), "\n" if $VERBOSE; - sleep 10; - $remainingCount = scalar(keys %childProcesses); - } - my $forkCount = scalar(keys %childProcesses) + 1; +sub RunComprehensiveMode() { + foreach my $commitId (keys %WHITELIST_COMMIT_IDS) { + my $remainingCount = scalar(keys %childProcesses); + while ($remainingCount >= $FORK_LIMIT) { + print STDERR "Sleep a bit while $remainingCount children going for these commits ", + join(", ", sort values %childProcesses), "\n" if $VERBOSE; + sleep 10; + $remainingCount = scalar(keys %childProcesses); + } + my $forkCount = scalar(keys %childProcesses) + 1; my $pid = fork(); die "cannot fork: $!" unless defined $pid; if ($pid == 0) { # The new child process is here @@ -306,6 +299,15 @@ while (scalar(keys %childProcesses) > 0) { sleep 10; } + +############################################################################## +# Main line of script + +if (defined $CENTRAL_COMMIT) { + RunCentralCommitMode($CENTRAL_COMMIT); +} + +exit 0; my $startCnt = scalar(keys %WHITELIST_COMMIT_IDS); my $doneCnt = scalar(keys %finishedOperations); print STDERR "ERROR: all children completed but ", $doneCnt - $startCnt, " not completed\n";