ServicingPipeline: Warn when local release-XX branch is not uptodate (#17260)

This prevents me from making dumb mistakes, really.

(cherry picked from commit bf55c444601117dfb09b405752f4ea105e078997)
Service-Card-Id: 92546837
Service-Version: 1.20
This commit is contained in:
Dustin L. Howett 2024-05-14 14:19:01 -05:00 committed by Dustin L. Howett
parent 488bef7bca
commit fc6f83e086

View File

@ -89,6 +89,20 @@ $Cards = Get-GithubProjectCard -ColumnId $ToPickColumn.id
& git fetch --all 2>&1 | Out-Null
$Branch = & git rev-parse --abbrev-ref HEAD
$RemoteForCurrentBranch = & git config "branch.$Branch.remote"
$CommitsBehind = [int](& git rev-list --count "$RemoteForCurrentBranch/$Branch" "^$Branch")
If ($LASTEXITCODE -Ne 0) {
Write-Error "Failed to determine branch divergence"
Exit 1
}
If ($CommitsBehind -Gt 0) {
Write-Error "Local branch $Branch is out of date with $RemoteForCurrentBranch; consider git pull"
Exit 1
}
$Entries = @(& git log $SourceBranch --first-parent --grep "(#\($($Cards.Number -Join "\|")\))" "--pretty=format:%H%x1C%s" |
ConvertFrom-CSV -Delimiter "`u{001C}" -Header CommitID,Subject)