sync SVN r18124

This commit is contained in:
2026-09-16 12:10:59 +03:00
parent 20a751eca4
commit 4756dc0b6c

View File

@@ -4,8 +4,11 @@
# Utilizare:
# powershell -File COMUN\utile\scrie_backstop_skills.ps1 -Root D:\ROA
# powershell -File COMUN\utile\scrie_backstop_skills.ps1 -Root D:\ROA -DryRun
# powershell -File COMUN\utile\scrie_backstop_skills.ps1 -Root D:\ROA -Proiecte ROAFACTURARE,ROAGEST
# -Proiecte: cand e dat, se proceseaza DOAR acele subdirectoare imediate ale lui -Root.
param(
[string]$Root = 'D:\ROA',
[string[]]$Proiecte,
[switch]$DryRun
)
@@ -67,10 +70,28 @@ if (-not (Test-Path -LiteralPath $Root -PathType Container)) {
exit 0
}
$proiecte = @(Get-ChildItem -LiteralPath $Root -Directory -ErrorAction SilentlyContinue | Sort-Object Name)
$gasite = 0; $create = 0; $actualizate = 0; $ok = 0; $sarite = 0
if ($PSBoundParameters.ContainsKey('Proiecte') -and $Proiecte.Count -gt 0) {
$numeProiecte = @()
foreach ($n in $Proiecte) {
foreach ($buc in ($n -split ',')) {
if (-not [string]::IsNullOrWhiteSpace($buc)) { $numeProiecte += $buc.Trim() }
}
}
$listaProiecte = @()
foreach ($n in $numeProiecte) {
$caleProiect = Join-Path $Root $n
if (Test-Path -LiteralPath $caleProiect -PathType Container) {
$listaProiecte += Get-Item -LiteralPath $caleProiect
} else {
Write-Output ('Proiect cerut inexistent: ' + $n)
}
}
} else {
$listaProiecte = @(Get-ChildItem -LiteralPath $Root -Directory -ErrorAction SilentlyContinue | Sort-Object Name)
}
$gasite = 0; $create = 0; $actualizate = 0; $ok = 0; $sarite = 0; $deja = 0
foreach ($p in $proiecte) {
foreach ($p in $listaProiecte) {
if ($NumeSarite -contains $p.Name) { continue }
if (-not (Test-Path -LiteralPath (Join-Path $p.FullName 'COMUN') -PathType Container)) { continue }
$areSvn = Test-Path -LiteralPath (Join-Path $p.FullName '.svn') -PathType Container
@@ -102,6 +123,12 @@ foreach ($p in $proiecte) {
}
$raw = [IO.File]::ReadAllText($cale)
$areMarcaje = ($raw.IndexOf($MarkerStart) -ge 0) -and ($raw.IndexOf($MarkerEnd) -gt $raw.IndexOf($MarkerStart))
if (-not $areMarcaje -and $raw.Contains('roa-')) {
Write-Output (' ' + $nume + ' deja')
$deja++
continue
}
$nl = Ia-Terminator $raw
$nou = Continut-Marcat -Continut $raw -nl $nl
if ($null -eq $nou) {
@@ -122,5 +149,5 @@ foreach ($p in $proiecte) {
Write-Output ''
$eticheta = 'scrie_backstop_skills'
if ($DryRun) { $eticheta = $eticheta + ' (DryRun)' }
Write-Output ($eticheta + ': ' + $gasite + ' proiecte, ' + $create + ' create, ' + $actualizate + ' actualizate, ' + $ok + ' neschimbate, ' + $sarite + ' sarite')
Write-Output ($eticheta + ': ' + $gasite + ' proiecte, ' + $create + ' create, ' + $actualizate + ' actualizate, ' + $ok + ' neschimbate, ' + $deja + ' deja, ' + $sarite + ' sarite')
exit 0