Permalink
Browse files

#parse_hg_dirty added to mercurial plugin

  • Loading branch information...
1 parent 858bea8 commit b185dde88e33df3b14f301dbadbff93129a07fe2 @lucassmagal committed Oct 6, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 plugins/mercurial/mercurial.plugin.zsh
View
10 plugins/mercurial/mercurial.plugin.zsh
@@ -17,4 +17,14 @@ function hg_current_branch() {
if [ -d .hg ]; then
echo $(hg branch)
fi
+}
+
+parse_hg_dirty() {
+ hg status 2> /dev/null \
+ | awk '$1 == "?" { unknown = 1 }
+ $1 != "?" { changed = 1 }
+ END {
+ if (changed) printf "$ZSH_THEME_GIT_PROMPT_DIRTY"
+ else if (unknown) printf "$ZSH_THEME_GIT_PROMPT_CLEAN"
+ }'
}

0 comments on commit b185dde

Please sign in to comment.