Last active
July 22, 2016 07:28
-
-
Save vmiheer/fb8793cfba741081dd303b16b1bab9a8 to your computer and use it in GitHub Desktop.
better p4 sync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Sync-Perforce($Path) | |
{ | |
Write-Host $Path | |
$arguement = "$($Path)/..."; | |
p4 sync $arguement 1>$null 2>&1; | |
if ($LASTEXITCODE -ne 0) { | |
$output = & p4 sync $arguement 2>&1; | |
if ($output.CategoryInfo.TargetName -eq "Request too large (over 750000); see 'p4 help maxresults'.") { | |
Write-Debug "Request too large! Retrying Subdirs"; | |
$SubDirs = &p4 dirs -C "$($Path)/*" | |
foreach ($i in $SubDirs) { | |
Sync-Perforce $i; | |
} | |
} else { | |
Write-Error $output.CategoryInfo.TargetName; | |
Write-Error "Unknown sync error!"; | |
throw "Sync error!"; | |
} | |
} | |
if ((Get-PSCallStack).Length -eq 2) { | |
p4 resolve -am //...; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment