Update fetch-repos.ps1 and pull-repos.ps1

This commit is contained in:
Markus Fleschutz 2021-05-26 20:00:47 +02:00
parent fc97a6054b
commit 0501b9cd26
2 changed files with 8 additions and 6 deletions

View File

@ -16,19 +16,20 @@ try {
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$Folders = (get-childItem "$ParentDir" -attributes Directory)
$FolderCount = $Folders.Count
$ParentDirName = (get-item "$ParentDir").Name
"Fetching updates for $($Folders.Count) Git repositories at 📂$ParentDirName..."
"Fetching updates for $FolderCount Git repositories at 📂$ParentDirName..."
foreach ($Folder in $Folders) {
$FolderName = (get-item "$Folder").Name
"🢃 Fetching 📂$FolderName ..."
"🢃 Fetching 📂$FolderName..."
& git -C "$Folder" fetch --all --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ fetched $($Folders.Count) Git repositories at 📂$ParentDirName in $Elapsed sec."
"✔️ fetched $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec."
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -16,12 +16,13 @@ try {
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$Folders = (get-childItem "$ParentDir" -attributes Directory)
$FolderCount = $Folders.Count
$ParentDirName = (get-item "$ParentDir").Name
"Pulling updates for $($Folders.Count) Git repositories at 📂$ParentDirName ..."
"Pulling updates for $FolderCount Git repositories at 📂$ParentDirName..."
foreach ($Folder in $Folders) {
$FolderName = (get-item "$Folder").Name
"🢃 Pulling 📂$FolderName ..."
"🢃 Pulling 📂$FolderName..."
& git -C "$Folder" pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") {
@ -30,7 +31,7 @@ try {
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ updated $($Folders.Count) Git repositories at 📂$ParentDirName in $Elapsed sec."
"✔️ updated $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec."
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"