A Mercurial PowerShell Prompt

Since switching to Mercurial I often use the “hg summary” command.

hg summary [--remote]

aliases: sum

summarize working directory state

    This generates a brief summary of the working directory state, including
parents, branch, commit status, and available updates.

    With the --remote option, this will check the default paths for incoming
and outgoing changes. This can be time-consuming.

 

When you execute this command in a directory that is under source control you will see something like this:

parent: 35:008279cba4b4 tip
This is the commit message of the last checkin
branch: default
commit: 1 modified, 1 unknown
update: (current)

 

I am usually most interested in which branch I am currently working in and what is the current status of my working directory.  Since I use PowerShell as my command line I decided to overwrite the default PowerShell prompt (PS >) with some of the data from the “hg summary” command.

To do this I added the following code to my PowerShell profile: Continue reading at MatthewManela.com...