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

This commit is contained in:
Markus Fleschutz 2022-08-31 09:06:20 +02:00
parent 64b1382868
commit 2ec537cd64
2 changed files with 9 additions and 9 deletions

View File

@ -23,7 +23,7 @@ try {
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$ParentDirName = (Get-Item "$ParentDir").Name
"⏳ Step 2 - Checking parent folder 📂$ParentDirName..."
"⏳ Step 2 - Checking folder 📂$ParentDirName..."
if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" }
$Folders = (Get-ChildItem "$ParentDir" -attributes Directory)
$NumFolders = $Folders.Count
@ -31,8 +31,8 @@ try {
[int]$Step = 3
foreach ($Folder in $Folders) {
$FolderName = (get-item "$Folder").Name
"⏳ Step $Step/$($NumFolders + 2) - Fetching 📂$FolderName..."
$FolderName = (Get-Item "$Folder").Name
"⏳ Step $Step/$($NumFolders + 2) - Fetching into 📂$FolderName..."
& git -C "$Folder" fetch --all --recurse-submodules --prune --prune-tags --force
if ($lastExitCode -ne "0") { throw "'git fetch' in $FolderName failed" }
@ -41,7 +41,7 @@ try {
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ fetched $NumFolders Git repositories at 📂$ParentDirName in $Elapsed sec"
"✔️ fetched $NumFolders Git repos at 📂$ParentDirName in $Elapsed sec"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -23,7 +23,7 @@ try {
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$ParentDirName = (Get-Item "$ParentDir").Name
"⏳ Step 2 - Checking parent folder 📂$ParentDirName..."
"⏳ Step 2 - Checking folder 📂$ParentDirName..."
if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" }
$Folders = (Get-ChildItem "$ParentDir" -attributes Directory)
$NumFolders = $Folders.Count
@ -32,8 +32,8 @@ try {
[int]$Step = 3
[int]$Failed = 0
foreach ($Folder in $Folders) {
$FolderName = (get-item "$Folder").Name
"⏳ Step $Step/$($NumFolders + 2) - Pulling 📂$FolderName... "
$FolderName = (Get-Item "$Folder").Name
"⏳ Step $Step/$($NumFolders + 2) - Pulling into 📂$FolderName... "
& git -C "$Folder" pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { $Failed++; write-warning "'git pull' in 📂$FolderName failed" }
@ -45,9 +45,9 @@ try {
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ pulled $NumFolders repos in 📂$ParentDirName in $Elapsed sec ($Failed failed)"
"✔️ pulled $NumFolders Git repos at 📂$ParentDirName in $Elapsed sec ($Failed failed)"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}