我现在手动加了一下,但是每次版本更新都会被覆盖
这个是我手动加的推送标记,这个是执行脚本,希望你们能加上,这个功能对我来说很重要
windows上的执行脚本
```# Adds "Push Tags" (git.pushTags) to the Source Control > "..." > Tags submenu
#
#
param([switch]$Restore)
$ErrorActionPreference = 'Stop'
$target = 'C:\Program Files\Qoder CN IDE\resources\app\extensions\git\package.json'
$backup = "$target.orig"
$original = '"git.tags":[{"command":"git.createTag","group":"tags@1"},{"command":"git.deleteTag","group":"tags@2"},{"command":"git.deleteRemoteTag","group":"tags@3"}]'
$patched = '"git.tags":[{"command":"git.createTag","group":"tags@1"},{"command":"git.deleteTag","group":"tags@2"},{"command":"git.deleteRemoteTag","group":"tags@3"},{"command":"git.pushTags","group":"tags@4"}]'
if (-not (Test-Path -LiteralPath $target)) {
Write-Host "[X] File not found: $target" -ForegroundColor Red
Write-Host ' The IDE install path may differ; locate the git extension package.json first.'
exit 1
}
$content = [System.IO.File]::ReadAllText($target)
if (-not $Restore -and $content.Contains($patched)) {
Write-Host '[=] Already patched, nothing to do.' -ForegroundColor Yellow
Write-Host ' Use -Restore to roll back if needed.'
exit 0
}
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host '[X] Not running as Administrator - the target folder is write protected.' -ForegroundColor Red
Write-Host ' Open PowerShell from the Start menu with "Run as administrator", then retry.'
exit 1
}
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
if ($Restore) {
if (-not (Test-Path -LiteralPath $backup)) {
Write-Host "[X] No backup found at $backup - nothing to restore." -ForegroundColor Red
exit 1
}
Copy-Item -LiteralPath $backup -Destination $target -Force
Write-Host '[OK] Restored from backup.' -ForegroundColor Green
exit 0
}
$hits = ([regex]::Matches($content, [regex]::Escape($original))).Count
if ($hits -ne 1) {
Write-Host "[X] Expected 1 match, found $hits. Aborted (the IDE version may have changed)." -ForegroundColor Red
exit 1
}
if (-not (Test-Path -LiteralPath $backup)) {
Copy-Item -LiteralPath $target -Destination $backup
Write-Host "[i] Backup created: $backup"
}
[System.IO.File]::WriteAllText($target, $content.Replace($original, $patched), $utf8NoBom)
$check = [System.IO.File]::ReadAllText($target)
try {
$null = $check | ConvertFrom-Json
} catch {
Write-Host '[X] JSON validation failed, rolling back...' -ForegroundColor Red
Copy-Item -LiteralPath $backup -Destination $target -Force
Write-Host '[OK] Rolled back to the original file.' -ForegroundColor Green
exit 1
}
if (-not $check.Contains($patched)) {
Write-Host '[X] Patched entry not found after writing.' -ForegroundColor Red
exit 1
}
Write-Host '[OK] Patch applied. The Tags submenu now has 4 items.' -ForegroundColor Green
Write-Host ' Fully quit and restart the IDE, then check:' -ForegroundColor Cyan
Write-Host ' Source Control > "..." > Tags -> Push Tags'
```
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。