From 4756dc0b6c208b3418d5f737becd64f4b47dff98 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Wed, 16 Sep 2026 12:10:59 +0300 Subject: [PATCH] sync SVN r18124 --- utile/scrie_backstop_skills.ps1 | 35 +++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/utile/scrie_backstop_skills.ps1 b/utile/scrie_backstop_skills.ps1 index c124490..c66f20b 100644 --- a/utile/scrie_backstop_skills.ps1 +++ b/utile/scrie_backstop_skills.ps1 @@ -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