Skip to content

Instantly share code, notes, and snippets.

@deevus
Created December 21, 2011 17:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deevus/1506832 to your computer and use it in GitHub Desktop.
Save deevus/1506832 to your computer and use it in GitHub Desktop.
Powershell script to pull and update all Mercurial repositories in the host directory
Cls
Write-Host "Searching for repositories to update..."
Write-Host
$dirs = Get-ChildItem | where {$_.PsIsContainer} | where { Get-ChildItem $_ -filter ".hg" }
foreach ($dir in $dirs)
{
Start-Job -Name HgUpdate$dir -ArgumentList @($dir.FullName) -ScriptBlock {
pushd $args[0]
hg pull --update
} | Out-Null
"Created job for repository: " + $dir
}
Cls
Write-Host "Waiting for jobs to complete..."
Wait-Job HgUpdate* | Out-Null
Cls
Receive-Job HgUpdate*
Write-Host
Write-Host "All jobs completed."
Write-Host "Press any key to continue..."
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment