Skip to content

Commit

Permalink
Fixed output of mercurial#parse_hg_dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassmagal committed Oct 6, 2012
1 parent b185dde commit 2617b62
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions plugins/mercurial/mercurial.plugin.zsh
Expand Up @@ -19,12 +19,11 @@ function hg_current_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"
}'
function parse_hg_dirty() {
local num_status=$(hg status | wc -l)
if [ $num_status -eq 0 ]; then
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
else
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
fi
}

0 comments on commit 2617b62

Please sign in to comment.