## p4sudo ## Aaron Bockelie function p4sudo {param($depot,$depotxml) if (!$depotxml) { $depotxml = $env:depotsxml } else { $depotxml = ".\depots.xml" } try { $xml = [xml](gc $depotxml) } catch { $message = "Cound not find depot xml file `'" + $depotxml + "`'. Edit function to static define location or specify manually with -depotxml switch." write-error $message -category ObjectNotFound } if ($depot) { if ($xml) { $depot = $xml.perforce.depot | ?{$_.name -eq $depot} if ($depot) { p4loginhash -server $depot.name -port $depot.port -username $depot.username -password $depot.passwordhash } else { write-error "The requested depot is not valid." } } } else { if ($xml) { write-host "This is a list of depots you may log into:`r`n`r`n" write-host (" " + ($xml.perforce.depot | %{$_.name + "`r`n"})) } } }