1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00

Use PhutilConsoleProgressBar for the repository/reparse.php script

Summary: The output from this script is too verbose... all that I care about is the overall progress.

Test Plan:
Ran the script on a large repository.

```lang=bash
./scripts/repository/reparse.php --all XYZ --message
NOTE: This script will queue tasks to reparse the data. Once the tasks have been queued, you need to run Taskmaster daemons to execute them.

QUEUEING TASKS (92,969 Commits):
[                                                                  ]   0.1%
```

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10441
This commit is contained in:
Joshua Spence 2014-09-09 00:04:25 +10:00
parent ee6afccb10
commit 6f806bd12b

View file

@ -218,6 +218,9 @@ if ($all_from_repo && !$force_local) {
echo "QUEUEING TASKS (".number_format(count($commits))." Commits):\n"; echo "QUEUEING TASKS (".number_format(count($commits))." Commits):\n";
} }
$progress = new PhutilConsoleProgressBar();
$progress->setTotal(count($commits));
$tasks = array(); $tasks = array();
foreach ($commits as $commit) { foreach ($commits as $commit) {
$classes = array(); $classes = array();
@ -271,20 +274,18 @@ foreach ($commits as $commit) {
$class, $class,
$spec, $spec,
PhabricatorWorker::PRIORITY_IMPORT); PhabricatorWorker::PRIORITY_IMPORT);
$commit_name = 'r'.$callsign.$commit->getCommitIdentifier();
echo " Queued '{$class}' for commit '{$commit_name}'.\n";
} }
} else { } else {
foreach ($classes as $class) { foreach ($classes as $class) {
$worker = newv($class, array($spec)); $worker = newv($class, array($spec));
echo "Running '{$class}'...\n";
$worker->executeTask(); $worker->executeTask();
} }
} }
$progress->update(1);
} }
echo "\nDone.\n"; $progress->done();
function usage($message) { function usage($message) {
echo phutil_console_format( echo phutil_console_format(