From ac2aac5edce2a2916b1db552756d775b30ee2d45 Mon Sep 17 00:00:00 2001 From: Erik van de Ven Date: Wed, 20 Apr 2016 17:44:19 +0200 Subject: [PATCH] add mercurial status support --- .bash_profile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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\]"