Using Mercurial with Windows Powershell
Last month I wrote about using git with Windows Powershell by making use of a custom prompt function as well as tab expansion. My sample code for the git tab expansion and Mark’s custom prompt are now available on GitHub in the posh-git project.
I’ve also ported both the prompt and the tab expansion to work with Mercurial.
Much like the git prompt, the Mercurial prompt shows the name of the branch as well as other information. The prompt shows the following information:
- “hg” – Identifies this as a mercurial repository (so I can tell whether I’m using git or mercurial)
- “default” – We’re currently on the “default” branch
- “+<number>” – Number of files that have been added but not yet committed
- “~<number>” – Number of files that have been modified but not yet committed
- “-<number>” – Number of files that have been removed but not yet committed
- “?<number>” – Number of untracked files in the repository
- “!<number>” – Number of missing files
I’ve also written some basic tab expansion functionality that provides completion for hg commands as well as hgtk commands (the TortoiseHg command line tool).
Code can be found in the posh-hg repository (somewhat ironically hosted on GitHub).
Written on April 21, 2010