Subversion Repositories DevTools

Rev

Rev 5287 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5287 Rev 5288
Line 8... Line 8...
8
 
8
 
9
    Assumption: The slave Repos will be setup on the current machine
9
    Assumption: The slave Repos will be setup on the current machine
10
 
10
 
11
	It will
11
	It will
12
		Scan the Repos on the Master
12
		Scan the Repos on the Master
13
        Determine those that are mastered onthe master (ignore non Master Repos)
13
        Determine those that are mastered on the master (ignore non Master Repos)
14
        Determine those Repos not on the current machine
14
        Determine those Repos not on the current machine
15
        Setup as Slave Replicas those Repos that are not on the master
15
        Setup as Slave Replicas those Repos that are not on the current machine
16
            Add this machine to the Masters list of replicators
16
            Add this machine to the Masters list of replicators
17
            Create the Repo and link it to the Master
17
            Create the Repo and link it to the Master
18
            Copy in Repo-wide hook files
18
            Copy in hook files from the master
19
 
19
 
20
.PARAMETER  Master
20
.PARAMETER  Master
21
Name of new the master server
21
Name of new the master server
22
 
22
 
23
.EXAMPLE
23
.EXAMPLE
Line 45... Line 45...
45
{
45
{
46
    $repoData = Get-CimInstance -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository | Where { $_.Name -eq $repoName } 
46
    $repoData = Get-CimInstance -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository | Where { $_.Name -eq $repoName } 
47
    Return $RepoData
47
    Return $RepoData
48
}
48
}
49
 
49
 
-
 
50
#
-
 
51
#   Get information on a named repo on the named Computer
-
 
52
function GetRemoteRepoInfo( $repoName, $ComputerName )
-
 
53
{
-
 
54
    $repoData = Get-CimInstance -Namespace "root\VisualSVN" -ClassName VisualSVN_Repository -ComputerName $ComputerName | Where { $_.Name -eq $repoName } 
-
 
55
    Return $RepoData
-
 
56
}
-
 
57
 
-
 
58
#
-
 
59
# Convert Absolute Path to UNC on a named computer
-
 
60
#
-
 
61
Function AbsToUnc( $ComputerName, $absPath )
-
 
62
{
-
 
63
    return '\\' + $ComputerName + '\' + $absPath.Replace(":","$")
-
 
64
}
50
 
65
 
51
#
66
#
52
#   Verify that the Master exists
67
#   Verify that the Master exists
53
#   
68
#   
54
$masterSession = New-CimSession $MASTER -ErrorAction Ignore
69
$masterSession = New-CimSession $MASTER -ErrorAction Ignore
Line 96... Line 111...
96
    {
111
    {
97
        Write-Error 'Cannot fetch Repo Info for created Repo: $repoName'
112
        Write-Error 'Cannot fetch Repo Info for created Repo: $repoName'
98
        Return
113
        Return
99
    }
114
    }
100
    $HookDst = $repoInfo.Path
115
    $HookDst = $repoInfo.Path
-
 
116
 
-
 
117
    #
-
 
118
    # Determine the source of the hooks
-
 
119
    #
-
 
120
    $masterRepo = GetRemoteRepoInfo $repoName $MASTER
-
 
121
    $masterHookPathUnc = AbsToUnc $MASTER  ($masterRepo.Path  + '\hooks')
-
 
122
    $specialHooks = Test-Path ($masterHookPathUnc + '\specialhooks')
-
 
123
    Write-Host ("{0,20} : {1}" -f $repoName, "Master Hooks: $masterHookPathUnc")
-
 
124
    #Write-Host ("{0,20} : {1}" -f $repoName, "Special Hooks: $specialHooks")
-
 
125
    
101
    $HookSrc = Split-Path -parent $HookDst
126
    $HookSrc = $masterHookPathUnc
102
    #Write-Host "HookDst: $HookDst"
127
    #Write-Host "HookDst: $HookDst"
103
    #Write-Host "HookSrc: $HookSrc"
128
    #Write-Host "HookSrc: $HookSrc"
104
    $HookFileCount = 0
129
    $HookFileCount = 0
105
    Get-ChildItem $HookSrc -Filter '*.cmd' | ForEach-Object {
130
    Get-ChildItem $HookSrc -Filter '*.cmd' | ForEach-Object {
106
        $srcFile = $_.Name
131
        $srcFile = $_.Name
Line 110... Line 135...
110
    }
135
    }
111
    If ($HookFileCount -eq 0 )
136
    If ($HookFileCount -eq 0 )
112
    {
137
    {
113
        Write-Host ("{0,20} : {1}" -f $repoName, "Warning: No Hook files found in the current Repository Store")
138
        Write-Host ("{0,20} : {1}" -f $repoName, "Warning: No Hook files found in the current Repository Store")
114
    }
139
    }
-
 
140
    If ($specialHooks)
-
 
141
    {
-
 
142
        Write-Host ("{0,20} : {1}" -f $repoName, "Copy specialhooks")
-
 
143
        Copy-Item ($HookSrc + '\specialhooks') -Destination ($HookDst + '/hooks') 
-
 
144
    }
115
}
145
}
116
 
146
 
117
 
147
 
118
 
148