mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 21:15:24 +00:00
Get latest script updated to handle Git
This commit is contained in:
parent
bc800cebf8
commit
890c3f8cdc
@ -48,17 +48,58 @@ try {
|
|||||||
throw "Multiple Unreal project files found in $(Get-Location)! Aborting."
|
throw "Multiple Unreal project files found in $(Get-Location)! Aborting."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Hard coded for Subversion right now
|
$isGit = Test-Path .git
|
||||||
if ($dryrun) {
|
|
||||||
Write-Output "Checking for updates we WOULD do:"
|
|
||||||
svn status --show-updates
|
|
||||||
} else {
|
|
||||||
Write-Output "Updating to latest..."
|
|
||||||
svn up
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($isGit) {
|
||||||
throw "Subversion update failed, see above"
|
git diff --no-patch --exit-code > $null
|
||||||
|
$unstagedChanges = ($LASTEXITCODE -ne 0)
|
||||||
|
git diff --no-patch --cached --exit-code > $null
|
||||||
|
$stagedChanges = ($LASTEXITCODE -ne 0)
|
||||||
|
|
||||||
|
if ($unstagedChanges -or $stagedChanges) {
|
||||||
|
if ($dryrun) {
|
||||||
|
Write-Output "Changes present, would have run 'git stash push'"
|
||||||
|
} else {
|
||||||
|
Write-Output "Working copy has changes, saving them in stash"
|
||||||
|
git stash push -q -m "Saved changes during Get Latest"
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Output "ERROR: git stash push failed, aborting"
|
||||||
|
exit 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use rebase pull to keep simpler
|
||||||
|
Write-Output "Pulling latest from Git..."
|
||||||
|
git pull --rebase
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Output "ERROR: git pull failed!"
|
||||||
|
exit 5
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($unstagedChanges -or $stagedChanges) {
|
||||||
|
Write-Output "Re-applying your saved changes..."
|
||||||
|
git stash pop > $null
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Output "ERROR: Failed to re-apply your changes, resolve manually from stash!"
|
||||||
|
exit 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# Assume svn
|
||||||
|
|
||||||
|
# Hard coded for Subversion right now
|
||||||
|
if ($dryrun) {
|
||||||
|
Write-Output "Checking for updates we WOULD do:"
|
||||||
|
svn status --show-updates
|
||||||
|
} else {
|
||||||
|
Write-Output "Updating to latest..."
|
||||||
|
svn up
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Subversion update failed, see above"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Now build
|
# Now build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user