C:\Users\shrimp [hg: default +] PS> # Mercurial リポジトリにいると "[hg: <ブランチ名>]" のように表示してくれる # 作業領域にコミットしていない変更がある場合は ブランチ名の後ろに "+" も表示
こんな感じに表示してくれる。
function Prompt { $HgBranch = hg branch 2> $null if ($HgBranch -ne $null) { if ((hg st 2> $null | where { $_ -match '^[MAR!] ' } | measure).Count -gt 0) { $HgBranch = "$hgBranch +" } $HgBranch = "[hg: $hgBranch]" } Write-Host -NoNewLine -ForegroundColor DarkGray "$(pwd)" Write-Host -ForegroundColor Yellow " $HgBranch" }
こんな感じの Prompt 関数を $env:userprofile の Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 に保存しておくと PowerShell の起動時に勝手に読み込んでくれるので楽。
プロンプトの表示タイミングでしか変更をチェックしないのがちょっと残念だけどまずまず便利に使ってる。