Functions/Get-HgUncommittedChangeset.ps1
function Get-HgUncommittedChangeset { <# .SYNOPSIS Returns the status of all the uncommitted changes in the current repository. .DESCRIPTION Returns the results of the `hg status` command as objects. Each object will have the following properties: * Path: The path (in the repository) to the file. * Modifed: True if the file is modifed. * Added: True if the file is added. * Removed: True if the files is removed. * Unknown: True if the file is unknown. * Clean: True if the file is clean. * Missing: True if the file is missing. * Ignored: True if the file is ignored. ALIASES ghgunc, hgst .EXAMPLE Get-HgUncommittedChanges Returns objects for each uncommitted change to a file in the repository in the current directory. .EXAMPLE Get-HgUncommittedChanges -Modified -Added -Removed Returns objects just for removed, modified, or added files. #> [CmdletBinding()] [OUtputType([PsHg.FileStatusInfo])] param( [Switch] # Return modified files $Modified, [Switch] # Return new/added files. $Added, [Switch] # Return removed files. $Removed, [Switch] # Return deleted/missing files. $Missing, [string] # The repository whose uncommitted changes to return. $RepoRoot = (Resolve-HgRoot), [string[]] # The paths whose uncommitted changes to get. $Path ) $modifiedArg = if( $Modified ) { '--modified' } else { '' } $addedArg = if( $Added ) { '--added' } else { '' } $removedArg = if( $Removed ) { '--removed' } else { '' } $missingArg = if( $Missing ) { '--deleted' } else { '' } hg status $modifiedArg $addedArg $removedArg -R $RepoRoot $Path | ForEach-Object { ($status,$file) = $_ -split ' ',2 New-Object PsHg.FileStatusInfo $file,$status } } Set-Alias -Name 'Get-HgUncommittedChanges' -Value 'Get-HgUncommittedChangeset' Set-Alias -Name 'hgst' -Value 'Get-HgUncommittedChangeset' Set-Alias -Name 'ghgunc' -Value 'Get-HgUncommittedChangeset' |