1

Trying to automate my morning ritual of updating multiple subversion working copies by using a powershell script. The svn update is working fine, but it would nice to hook into the SvnUpdateResult to show changes or any conflicts.

I've got as far as specifying the output parameter for the update result, but am not sure how to overcome the ambiguous overloads exception? I am already specifying the parameter types:

try {
    Add-Type -Path "C:\Program Files\SharpSVN\SharpSvn.dll"
}
catch [System.BadImageFormatException] {
    Write-Host "LFMF: You're probably using 32bit SharpSVN.dll in 64bit powershell ;-)"
}
$paths = @("Project-Trunk", "Project-Branch");
$currentPath = (Get-Location).Path
$svnClient = New-Object SharpSvn.SvnClient
foreach ($path in $paths) {
    Write-Host "Updating" $path
    $svnLocalPath = Join-Path $currentPath $path;
    # Throws: Multiple ambiguous overloads found for "Update" and the argument count: "2".
    $svnClient.Update([string]$svnLocalPath, [ref][SharpSvn.SvnUpdateResult]$result)
}

I appreciate I could just use svn client or tortoiseproc, but I'm trying to learn more about powershell.

si618
  • 16,580
  • 12
  • 67
  • 84

1 Answers1

1

The result argument is a C# out argument, not a ref argument. (On the IL level an output argument is a ref argument, but I would guess that powershell handles it differently)

If output arguments are a problem it is also possible to get the same information from the notification handler.

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
  • Thanks Bert, I'll have a look at the notification handler. You're correct, powershell handles `out` using `[ref]`, see: http://stackoverflow.com/q/5276700/44540 – si618 Nov 07 '12 at 23:40