Functions/Get-HgChangeset.ps1

<#
.SYNOPSIS
Gets the Hg changeset specified by $Revision
 
.DESCRIPTION
This function allows you to specify the changeset you are interested in using the $Revision parameter.
Results are returned as an XML object with style specified byYou can specify $Revision in several ways including:
  * revset query
  * revision number
  * short node
  * full node
  * bookmark/tag/branch names
 
.OUTPUTS
PsHg.ChangesetInfo.
 
.EXAMPLE
Get-HgChangeset -Revision "author('Matt') and date(' ')"
 
Demonstrates how to find a changset using a revset query.
#>


function Get-HgChangeset
{
    [CmdletBinding()]
    [OutputType([PsHg.ChangesetInfo])]
    param(
        [Parameter(Mandatory = $true)]
        [string]
        # The revision to return.
        $Revision,

        [Parameter()]
        [string]
        # The Hg directory. Defaults to current.
        $RepoRoot = (Get-Location).Path,

        [Switch]
        # Get full changeset information that is slow to compute: file adds, file modifications, file deletes, etc.
        $Force
    )

    Set-StrictMode -Version "Latest"

    $RepoRoot = Resolve-HgRoot -Path $RepoRoot -ErrorAction:$ErrorActionPreference
    if( -not $RepoRoot )
    {
        return
    }

    $debugOrVerboseArg = '--verbose'
    if( $Force )
    {
        $debugOrVerboseArg = '--debug'
    }
    hg log --rev $Revision --repository $RepoRoot --style $PsHgStylePath $debugOrVerboseArg | 
        Split-HgXml 
}