Functions/Get-HgConflict.ps1
function Get-HgConflict { <# .SYNOPSIS Gets the list of merge conflicts. .DESCRIPTION Parses the output of Merucrial's `hg resolve -l` command, and returns object for each conflicted file and its current status. The objects returned have the following properties: * Path: The path to the file * Resolved: `True` if the file is resolved. `False` if it still has conflicts. .EXAMPLE Get-HgConflicts Gets the conflicts in the current directory's repository. .EXAMPLE Get-HgConflicts -RepoRoot C:\Projects\psHg Gets the conflicts in the `C:\Projects\psHg` directory #> [CmdletBinding()] param( [string] # The path to the repository. Defaults to the current directory. $RepoRoot = (Resolve-HgRoot) ) hg resolve -l -R $RepoRoot | ForEach-Object { ($status,$path) = $_ -split ' ',2 $info = @{ Path = $path; Resolved = $false; } $info = New-Object PsObject -Property $info switch( $status ) { 'U' { $info.Resolved = $false } 'R' { $info.Resolved = $true } default { Write-Error ('Unknown conflict status ''{0}''.' -f $status) } } $info } } Set-Alias -Name 'Get-HgConflicts' -Value 'Get-HgConflict' |