This commit is contained in:
Ryan Arana 2012-07-26 22:15:45 -07:00
commit 6698e72cef

View file

@ -12,3 +12,25 @@ alias hgp='hg push'
alias hgs='hg status' alias hgs='hg status'
# this is the 'git commit --amend' equivalent # this is the 'git commit --amend' equivalent
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
# Theme vars and functions
ZSH_THEME_HG_PROMPT_PREFIX="hg:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_HG_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_HG_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_HG_PROMPT_CLEAN="" # Text to display if the branch is clean
# get the name of the branch we are on
function hg_prompt_info() {
ref=$(hg branch 2> /dev/null) || return
echo "$ZSH_THEME_HG_PROMPT_PREFIX${ref}$(parse_hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX"
}
# Checks if working tree is dirty
parse_hg_dirty() {
if [[ -n $(hg status 2> /dev/null) ]]; then
echo "$ZSH_THEME_HG_PROMPT_DIRTY"
else
echo "$ZSH_THEME_HG_PROMPT_CLEAN"
fi
}