On huge repositories, like the one we use at work, calling `hg branch`
can be very long. To get a sensible boost, directly get the branch name
from .hg/branch. It is tremendously faster.
Average time on 10 calls of `hg_get_branch_name`:
Before: `/tmp/test.zsh 0.08s user 0.04s system 96% cpu 0.133 total`
After: `/tmp/test.zsh 0.00s user 0.00s system 71% cpu 0.008 total`
It's faster and it uses less CPU.
Rather than trying to emulate `git commit --amend` using mercurial queues (which might have side effects if you're using MQ for other things) use the `commit --amend` command which was introduced in Mercurial 2.2 (2012-05-01).
Closes#4616
Changes the `plugins=(... mercurial ...)` to be closer to correct zsh syntax, removing commas and extra spaces.
Revises discussion on configuring themes to avoid sounding like users should modify the theme definition file in the main OMZ folder. Prioritizes the suggestion of using a theme which already supports hg_prompt_info.
If a user sets ZSH_THEME_HG_PROMPT_* as the following, he ends up with
%{$reset_color%} resetting the bold style of last character ")" because
_SUFFIX was expanded before calling hg_dirty():
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[blue]%}hg:(%{$fg[white]%}"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[blue]%})"
With this patch, the variable ZSH_THEME_HG_PROMPT_SUFFIX is lastly
displayed, following the same order as in git_prompt_info(),
i.e. <prefix><dirty><suffix>.
The original hgic and hgoc aliases worked well for the default path, but attempting to call them with a different path failed. I created functions to handle them instead.
implement in_hg(), hg_get_branch_name(), hg_prompt_info(), and hg_dirty() for the mercurial plugin
named functions similar to subversion plugin, to give theme maintainers an easier life
The -v flag for these commands really isn't very useful. It will
output some information about the hooks it is running, but that is
generally not useful and just noisy. The desire to add -v to these
commands is exceptional and IMHO it's better to make the common
case of not seeing those messages the supported behavior.