Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

Commit 07a6f46

Browse files
edg2sMatmaRex
authored andcommitted
Show progress counter when updating repos
1 parent a077e45 commit 07a6f46

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

new.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,24 +319,27 @@ function set_progress( float $pc, string $label ) {
319319
'NAME' => $namePath,
320320
];
321321

322-
set_progress( 5, 'Updating repositories...' );
323-
324322
$start = 5;
325323
$end = 40;
324+
$n = 1;
326325
$repoProgress = $start;
326+
$repoCount = count( $repos );
327327

328328
foreach ( $repos as $source => $target ) {
329+
set_progress( $repoProgress, "Updating repositories ($n/$repoCount)..." );
330+
329331
$error = shell_echo( __DIR__ . '/new/updaterepos.sh',
330332
$baseEnv + [
331-
'REPOSITORIES' => "$source $target",
333+
'REPO_SOURCE' => $source,
332334
]
333335
);
336+
334337
if ( $error ) {
335338
abandon( "Could not update repository <em>$source</em>" );
336339
}
337340

338-
$repoProgress += ( $end - $start ) / count( $repos );
339-
set_progress( $repoProgress, 'Updating repositories...' );
341+
$repoProgress += ( $end - $start ) / $repoCount;
342+
$n++;
340343
}
341344

342345
// Just creates empty folders so no need for progress update

new/updaterepos.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/bin/bash
22
set -ex
33

4-
while IFS=' ' read -r repo dir; do
5-
git --git-dir=$PATCHDEMO/repositories/$repo/.git fetch --all
6-
done <<< "$REPOSITORIES"
4+
git --git-dir=$PATCHDEMO/repositories/$REPO_SOURCE/.git fetch --all

0 commit comments

Comments
 (0)