Functions/Test-HgOutgoingChangeset.ps1
function Test-HgOutgoingChangeset { <# .SYNOPSIS Tests if there are any outgoing changes that can be pushed. .DESCRIPTION Uses the `Get-HgOutgoingChangeset` function to retrieve any outgoing changes. If there are any, `$true` is returned. Otherwise, `$false`. ALIASES thgoutc .EXAMPLE Test-HgOutgoingChangeset Checks the repository in the current directory and returns `$true` if it has any outgoing changes, `$false` otherwise. .EXAMPLE Test-HgOutgoingChangeset -RepoRoot C:\Projects\PsHg Checks the repository at `C:\Projects\PsHg` if it has any outgoing/unpushed changes. .EXAMPLE Test-HgOutgoingChangeset -Revision stable Checks if there are any outgoing changes on the `stable` branch. #> [CmdletBinding()] param( [string] # The revision to check for outgoing changes. $Revision, [string] # Specifies an explicit repository $Destination, [string] # The repository to check. Defaults to the current directory. $RepoRoot = ((Get-Location).Path) ) $rRepoRoot = Resolve-HgRoot -Path $RepoRoot if( -not $rRepoRoot ) { return } Push-Location $rRepoRoot try { if( -not (Test-HgDefaultPath -Outgoing) ) { Write-Warning ('Repository {0}''s default path setting (paths.default or paths.default-push) not found.' -f $rRepoRoot) return } $revisionArg = @{ } if( $Revision ) { $revisionArg.Revision = $Revision } if ( $Destination ) { $revisionArg.Destination = $Destination } if( (Get-HgOutgoingChangeset @revisionArg) ) { return $true } else { return $false } } finally { Pop-Location } } Set-Alias -Name 'thgoutc' -Value 'Test-HgOutgoingChangeset' |