mirror of
https://github.com/microsoft/mcp.git
synced 2026-11-04 12:01:31 +00:00
Updated to [884dc88181 @ 2026-03-12](https://github.com/azure/azure-sdk-tools/tree/884dc88181901bdfec0dec0ff0c25f4f74f6deb3)
39 lines
1.2 KiB
PowerShell
39 lines
1.2 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$repoRoot = Join-Path $PSScriptRoot '..' '..' -Resolve
|
|
|
|
function Invoke($command) {
|
|
Invoke-Expression $command
|
|
if($LASTEXITCODE -ne 0) {
|
|
Write-Host "'$command' exited with code: $LASTEXITCODE." -ForegroundColor Red
|
|
exit $LASTEXITCODE
|
|
}
|
|
}
|
|
|
|
$remotes = Invoke 'git remote show'
|
|
if ($remotes -contains 'tools') {
|
|
Invoke 'git remote remove tools'
|
|
}
|
|
|
|
Invoke 'git remote add tools https://github.com/azure/azure-sdk-tools.git'
|
|
Invoke 'git fetch tools'
|
|
|
|
$engCommon = Join-Path $repoRoot 'eng' 'common'
|
|
|
|
$toolsMain = Invoke 'git rev-parse remotes/tools/main'
|
|
$commitDate = Invoke "git show -s --format=%cs $toolsMain"
|
|
|
|
$currentDirectory = Get-Location
|
|
Set-Location $repoRoot
|
|
try {
|
|
Remove-Item -Path $engCommon -Recurse -Force -ErrorAction SilentlyContinue
|
|
Invoke "git checkout $toolsMain -- eng/common"
|
|
Invoke 'git add eng/common'
|
|
|
|
$partialSha = Invoke "git rev-parse --short $toolsMain"
|
|
Invoke "git commit -m 'Update eng/common from tools repo`n`nUpdated to [$partialSha @ $commitDate](https://github.com/azure/azure-sdk-tools/tree/$toolsMain)'"
|
|
Invoke 'git remote remove tools'
|
|
}
|
|
finally {
|
|
Set-Location $currentDirectory
|
|
}
|