diff --git a/.bash_profile b/.bash_profile index 22d0ef9..3cab515 100644 --- a/.bash_profile +++ b/.bash_profile @@ -79,12 +79,18 @@ function parse_git_dirty() { function parse_git_branch() { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" } +function parse_hg_dirty() { + [[ $(hg status 2> /dev/null | tail -n1) ]] && echo "*" +} +function parse_hg_branch() { + hg branch 2> /dev/null | sed -e "s/\(.*\)/\1$(parse_hg_dirty)/" +} # Change this symbol to something sweet. # (http://en.wikipedia.org/wiki/Unicode_symbols) symbol="⚡ " -export PS1="\[${MAGENTA}\]\u \[$RESET\]in \[$GREEN\]\w\[$RESET\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$RESET\]\n$symbol\[$RESET\]" +export PS1="\[${MAGENTA}\]\u \[$RESET\]in \[$GREEN\]\w\[$RESET\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$RESET\]\$([[ -n \$(hg branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_hg_branch)\[$RESET\]\n$symbol\[$RESET\]" export PS2="\[$ORANGE\]→ \[$RESET\]"