have number of modified and unknown mercurial files on prompt
I'm using the hg prompt extension to have a nice prompt while working with hg.
Right now my prompt looks like this:
~/my/current/path [hg default !]
the '!'
part in the prompt I get via the {status}
keyword of the hg prompt
showing me that are modified files. It shows a '?'
for unknown files
But I want开发者_开发问答 something similar to posh-hg
where it also shows the number of modified or unknown files.
I know I can get this information with hg summary
but my sed
fu is failing me on getting the regex correct to get the totals.
an example of the output of the hg summary
command:
parent: 0:16ed527e220f tip
parent commit message
branch: default
commit: 5 modified, 2 unknown
update: (current)
doing a hg summary | grep 'commit' I get back the correct line:
$ hg summary | grep 'commit'
commit: 5 modified, 2 unknown
given the output above, how can I get the number of modified and unknown files so that I can make my prompt look like this:
[hg default 5! 2?]
This works:
hg sum | sed -ne '/^commit:/{s/^commit: //;s/ modified/\!/;s/ unknown/?/;s/,//g;p}'
... although there might be a more elegant way to do it.
You can probably figure out the added
, deleted
etc part by yourself.
精彩评论