Add a switch to protect from unintended pushes
This commit is contained in:
parent
a4b35bd896
commit
3cc35da562
|
|
@ -2,13 +2,15 @@
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Updates each repo Universe builds to new dependencies.props
|
Updates each repo Universe builds to new dependencies.props.
|
||||||
.PARAMETER Source
|
.PARAMETER Source
|
||||||
The NuGet package source to find the lineup on.
|
The NuGet package source to find the lineup on.
|
||||||
.PARAMETER LineupID
|
.PARAMETER LineupID
|
||||||
The ID of the Lineup to determine which versions to use.
|
The ID of the Lineup to determine which versions to use.
|
||||||
.PARAMETER LineupVersion
|
.PARAMETER LineupVersion
|
||||||
The version of the Lineup to be used.
|
The version of the Lineup to be used.
|
||||||
|
.PARAMETER NoPush
|
||||||
|
Make commits without pusing.
|
||||||
#>
|
#>
|
||||||
[cmdletbinding(SupportsShouldProcess = $true)]
|
[cmdletbinding(SupportsShouldProcess = $true)]
|
||||||
param(
|
param(
|
||||||
|
|
@ -18,6 +20,7 @@ param(
|
||||||
[string]$LineupID,
|
[string]$LineupID,
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$LineupVersion,
|
[string]$LineupVersion,
|
||||||
|
[switch]$NoPush,
|
||||||
[string[]]$GitCommitArgs = @()
|
[string[]]$GitCommitArgs = @()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -52,7 +55,7 @@ try {
|
||||||
# Move to latest commit on tracked branch
|
# Move to latest commit on tracked branch
|
||||||
Invoke-Block { & git checkout --quiet $submodule.branch }
|
Invoke-Block { & git checkout --quiet $submodule.branch }
|
||||||
|
|
||||||
Invoke-Block { & .\run.ps1 upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile }
|
Invoke-Block { & .\run.ps1 -Update upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile }
|
||||||
Invoke-Block { & git add $depsFile }
|
Invoke-Block { & git add $depsFile }
|
||||||
|
|
||||||
Invoke-Block { & git commit --quiet -m "Update dependencies.props`n`n[auto-updated: dependencies]" @GitCommitArgs }
|
Invoke-Block { & git commit --quiet -m "Update dependencies.props`n`n[auto-updated: dependencies]" @GitCommitArgs }
|
||||||
|
|
@ -74,25 +77,28 @@ try {
|
||||||
throw 'Failed to update'
|
throw 'Failed to update'
|
||||||
}
|
}
|
||||||
|
|
||||||
$push_errors = @()
|
if (-not $NoPush -and ($Force -or ($PSCmdlet.ShouldContinue($shortMessage, 'Push the changes to these repos?'))))
|
||||||
foreach($submodule in $updated_submodules)
|
|
||||||
{
|
{
|
||||||
Push-Location $submodule.path
|
$push_errors = @()
|
||||||
try {
|
foreach($submodule in $updated_submodules)
|
||||||
Invoke-Block { & git push origin $submodule.branch}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
{
|
||||||
$push_errors += $_
|
Push-Location $submodule.path
|
||||||
|
try {
|
||||||
|
Invoke-Block { & git push origin $submodule.branch}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
$push_errors += $_
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($push_errors.Count -gt 0 )
|
if ($push_errors.Count -gt 0 )
|
||||||
{
|
{
|
||||||
throw 'Failed to push'
|
throw 'Failed to push'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue