Functions/Test-HgUncommittedChangeset.ps1
function Test-HgUncommittedChangeset { <# .SYNOPSIS Tests if there are any uncommitted changes in a repository. .DESCRIPTION Checks if there are any modified, added, or removed files in the current directory so that you don't get Mercurial's "abort: uncommitted changes" error message. ALIASES thgunc .EXAMPLE Test-HgUncommittedChanges Returns `True` if there are any uncommitted changes in the current directory. `False` otherwise. .EXAMPLE Test-HgUncommittedChanges -RepoRoot c:\Projects\psHg Returns `True` if there are any uncommitted changes in the `C:\Projects\psHg` directory. `False` otherwise. #> [CmdletBinding()] param( [string] # The path to the repository to check. Defaults to the current directory. $RepoRoot = (Resolve-HgRoot), [string[]] # The path to check for uncommitted changes. $Path ) $getArgs = @{ } if( $Path ) { $getArgs.Path = $Path } $uncommittedChanges = Get-HgUncommittedChanges -Added -Modified -Removed -Missing -RepoRoot $RepoRoot @getArgs if( $uncommittedChanges ) { $true } else { $false } } Set-Alias -Name 'Test-HgUncommittedChanges' -Value 'Test-HgUncommittedChangeset' Set-Alias -Name 'thgunc' -Value 'Test-HgUncommittedChangeset' |