# Set your svn path $Svn = "svn.exe" trap { Write-Error "$_.Exception.GetType().FullName + $_.Exception.Message " } if ($args.length -ne 1) { throw "Invalid arguments" } $source_path = $args[0] $local_info = & $Svn info $source_path if ($LastExitCode -ne 0) { throw "Local svn info failed" } $local_revision = $local_info | %{ if ($_.startsWith("Revision")) { Write-Output $_ } } | %{ Write-Output $_.substring($_.indexOf(": ")+2) } $url = $local_info | %{ if ($_.startsWith("Repository Root")) { Write-Output $_ } } | %{ Write-Output $_.substring($_.indexOf(": ")+2) } $remote_info = & $Svn info $url if ($LastExitCode -ne 0) { throw "Remote svn info failed" } $remote_revision = $remote_info | %{ if ($_.startsWith("Revision")) { Write-Output $_ } } | %{ Write-Output $_.substring($_.indexOf(": ")+2) } if ($local_revision -ne $remote_revision) { svn update $source_path } else { Write-Host "Up to date" }