Functions/Test-HgTag.ps1
function Test-HgTag { <# .SYNOPSIS Tests if a tag exists. .DESCRIPTION If a tag exists, returns `$true`, otherwise `$false`. If checking for a tag in a place that doesn't have a directory, you'll get an error and nothing is returned. .EXAMPLE Test-HgTag -Name 'Hello' Demonstrates how to check if a tag exists. #> [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string] # The name of the tag to check for. $Name, [Parameter()] [string] # The path to the repository to check in. $RepoRoot = (Get-Location) ) Set-StrictMode -Version 'Latest' $RepoRoot = Resolve-HgRoot -Path $RepoRoot if( -not $RepoRoot ) { return } $tag = Get-HgTag -Name $Name -RepoRoot $RepoRoot | Where-Object { $_.Name -eq $Name } return ($tag -ne $null) } Set-Alias -Name 'thgt' -Value 'Test-HgTag' |