mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-08 17:28:18 +02:00
Improve the scripts
This commit is contained in:
parent
24fffac7b8
commit
1542765c41
@ -9,16 +9,17 @@
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
"Fetching updates for Git repository $RepoDir ..."
|
||||
"Fetching updates for Git repository $($RepoDir)..."
|
||||
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
& git fetch --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { # retry once:
|
||||
if ($lastExitCode -ne "0") {
|
||||
# retry once:
|
||||
start-sleep -milliseconds 1000
|
||||
& git fetch --all --recurse-submodules --jobs=1
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed (twice)" }
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -9,7 +9,6 @@
|
||||
param($ParentDir = "$PWD")
|
||||
|
||||
try {
|
||||
"Fetching updates for Git repositories under $($ParentDir)..."
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
@ -20,9 +19,12 @@ try {
|
||||
|
||||
[int]$Count = 0
|
||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||
& "$PSScriptRoot/fetch-repo.ps1" "$($_.FullName)"
|
||||
set-location "$($_.FullName)"
|
||||
|
||||
& "$PSScriptRoot/fetch-repo.ps1"
|
||||
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||
|
||||
set-location ..
|
||||
$Count++
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,8 @@ try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
& git pull --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git pull --recurse-submodules' failed" }
|
||||
& git pull --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||
|
||||
& git status
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed" }
|
||||
|
@ -9,7 +9,6 @@
|
||||
param($ParentDir = "$PWD")
|
||||
|
||||
try {
|
||||
"Pulling updates for Git repositories under $ParentDir ..."
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
@ -20,12 +19,12 @@ try {
|
||||
|
||||
[int]$Count = 0
|
||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||
"Pulling Git repository $($_.FullName)..."
|
||||
"Pulling updates for Git repository $($_.FullName)..."
|
||||
|
||||
set-location $_.FullName
|
||||
|
||||
& git pull --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git pull --recurse-submodules' failed" }
|
||||
& git pull --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||
|
||||
set-location ..
|
||||
$Count++
|
||||
|
Loading…
Reference in New Issue
Block a user