diff --git a/build/scripts/sync_remotes.ps1 b/build/scripts/sync_remotes.ps1 index 426b466..c924e19 100644 --- a/build/scripts/sync_remotes.ps1 +++ b/build/scripts/sync_remotes.ps1 @@ -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 {