Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<#.SYNOPSISThis Powershell script will update the repo-Wide hook in all the Repos.DESCRIPTIONThis Powershell script update the repo-Wide hook in all the Repos onthe current machine.It willLocate the Repositoties RootCopy *.cmd file from the root into each Repo SubdirUnless the special hooks/specialhooks file exists.EXAMPLEUpdateHooks.ps1.NOTESUses a number of cmdlets provided by VisualSVN.#>### Get information on a named repofunction GetRepoInfo( $repoName ){$repoData = Get-CimInstance -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository | Where { $_.Name -eq $repoName }Return $RepoData}## Get information on the current SVN server#function GetSvnInfo(){$repoData = Get-CimInstance -Namespace "root\VisualSVN" -ClassName VisualSVN_ServiceReturn $RepoData}## Determine the root of the Repositores$SvnInfo = GetSvnInfoif ($SvnInfo -eq $null){Write-Error 'Cannot get VisualSVN info'Exit}# Validate the Repo Root$repoRoot = $SvnInfo.RepositoriesRootIf (!(Test-Path $repoRoot)){Write-Error 'RepositoriesRoot - Does not exist'Exit}## Process each Repo$HookSrc = $repoRootGet-CimInstance -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository | Sort-Object Name | ForEach-Object {$hookPath = $_.Path + '/hooks'$repoName = $_.NameIf (!(Test-Path ($hookPath + '/specialhooks'))){$HookFileCount = 0Get-ChildItem $HookSrc -Filter '*.cmd' | ForEach-Object {$srcFile = $_.NameCopy-Item $_.FullName -Destination $hookPath$HookFileCount++}Write-Host ("{0,20} : {1}" -f $repoName, "Hooks copied: $HookFileCount")}else{Write-Host ("{0,20} : {1}" -f $repoName, "SPECIAL - No hooks copied")}}