fix: Correct PowerShell syntax in sync_remotes.ps1 and add graceful error handling
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
This commit is contained in:
parent
f0c96f15b8
commit
db0cef4797
1 changed files with 33 additions and 14 deletions
|
|
@ -9,7 +9,7 @@ $ErrorActionPreference = "Stop"
|
|||
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoRoot = Split-Path -Parent (Split-Path -Parent $scriptPath)
|
||||
|
||||
Write-Host "🔄 WebDrop Bridge - Remote Sync Script" -ForegroundColor Cyan
|
||||
Write-Host "Remote Sync Script - WebDrop Bridge" -ForegroundColor Cyan
|
||||
Write-Host "Repository: $repoRoot`n" -ForegroundColor Gray
|
||||
|
||||
# Change to repo directory
|
||||
|
|
@ -17,37 +17,56 @@ Push-Location $repoRoot
|
|||
|
||||
try {
|
||||
# Fetch from both remotes
|
||||
Write-Host "📥 Fetching from origin..." -ForegroundColor Yellow
|
||||
Write-Host "Fetching from origin..." -ForegroundColor Yellow
|
||||
git fetch origin
|
||||
|
||||
Write-Host "📥 Fetching from upstream..." -ForegroundColor Yellow
|
||||
Write-Host "Fetching from upstream..." -ForegroundColor Yellow
|
||||
git fetch upstream
|
||||
|
||||
# Show status
|
||||
Write-Host "`n📊 Remote Status:" -ForegroundColor Cyan
|
||||
Write-Host "`nRemote Status:" -ForegroundColor Cyan
|
||||
git remote -v
|
||||
|
||||
# Show branch comparison
|
||||
Write-Host "`n📋 Branch Comparison:" -ForegroundColor Cyan
|
||||
Write-Host "Local branches vs origin:" -ForegroundColor Gray
|
||||
git log --oneline origin/main -5 | ForEach-Object { Write-Host " origin: $_" }
|
||||
Write-Host ""
|
||||
git log --oneline upstream/main -5 | ForEach-Object { Write-Host " upstream: $_" }
|
||||
Write-Host "`nBranch Comparison:" -ForegroundColor Cyan
|
||||
Write-Host "Latest commits:" -ForegroundColor Gray
|
||||
|
||||
# Suppress errors for log commands
|
||||
$ErrorActionPreference = "SilentlyContinue"
|
||||
|
||||
$originLog = git log --oneline origin/main -5
|
||||
if ($originLog) {
|
||||
Write-Host "Origin:" -ForegroundColor Gray
|
||||
$originLog | ForEach-Object { Write-Host " $_" }
|
||||
} else {
|
||||
Write-Host " origin/main: (not found)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
$upstreamLog = git log --oneline upstream/main -5
|
||||
if ($upstreamLog) {
|
||||
Write-Host "Upstream:" -ForegroundColor Gray
|
||||
$upstreamLog | ForEach-Object { Write-Host " $_" }
|
||||
} else {
|
||||
Write-Host " upstream/main: (not found)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
# Restore error handling
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Optionally push to origin
|
||||
if ($PushToOrigin) {
|
||||
Write-Host "`n📤 Pushing current branch to origin..." -ForegroundColor Yellow
|
||||
Write-Host "`nPushing current branch to origin..." -ForegroundColor Yellow
|
||||
$currentBranch = git rev-parse --abbrev-ref HEAD
|
||||
git push origin $currentBranch
|
||||
Write-Host "✅ Pushed $currentBranch to origin" -ForegroundColor Green
|
||||
Write-Host "Pushed $currentBranch to origin" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "`n💡 Tip: Use --push-to-origin flag to push current branch to origin" -ForegroundColor Gray
|
||||
Write-Host "`nTip: Use --push-to-origin flag to push current branch to origin" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
Write-Host "`n✅ Sync complete!" -ForegroundColor Green
|
||||
Write-Host "`nSync complete!" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
Write-Host "`n❌ Error: $_" -ForegroundColor Red
|
||||
Write-Host "`nError: $_" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
finally {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue