Functions/Get-HgParent.ps1
function Get-HgParent { <# .SYNOPSIS Gets the parent(s) of the current changeset. .DESCRIPTION Every changest in Mercurial has one or two parents. This function runs the hg parents Mercurial command and returns objects for the current revision's first and, it it exists, second parent. ALIASES ghgp, hgparents, hgparent .EXAMPLE Get-HgParent Returns objects for the current revision's parents. .EXAMPLE Get-HgParent -Revision 542a1b3e7d80 Demonstrates how to get the parents for a specific revision. #> [CmdletBinding()] [OutputType([PsHg.ChangesetInfo])] param( [string] # The revision whose parent to get. $Revision, [string] # The path to the repository to work against. Defaults to the current location. $RepoRoot = (Resolve-HgRoot) ) Set-StrictMode -Version 'Latest' $RepoRoot = Resolve-HgRoot -Path $RepoRoot if( -not $RepoRoot ) { return } $revisionArgName = '' $revisionArgValue = '' if( $PSBoundParameters.ContainsKey('Revision') ) { $revisionArgName = '-r' $revisionArgValue = $Revision } hg parents --style $PsHgStylePath $revisionArgName $revisionArgValue -R $RepoRoot | Split-HgXml } Set-Alias -Name 'Get-HgParents' -Value 'Get-HgParent' Set-Alias -Name 'hgparents' -Value 'Get-HgParent' Set-Alias -Name 'hgparent' -Value 'Get-HgParent' Set-Alias -Name 'ghgp' -Value 'Get-HgParent' |