Commit 28b73741 authored by Yohann Bianchi's avatar Yohann Bianchi
Browse files

ADDED: Mercurial prompt info support even if hg prompt extension is unavailable

parent 8e9cf452
...@@ -87,18 +87,35 @@ prompt_hg() { ...@@ -87,18 +87,35 @@ prompt_hg() {
local rev status local rev status
if $(hg id >/dev/null 2>&1); then if $(hg id >/dev/null 2>&1); then
if $(hg prompt >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then
rev=$(hg prompt {status}) st=$(hg prompt {status})
if [[ $rev = "?" ]]; then if [[ $st = "?" ]]; then
# if files are not added
prompt_segment red white prompt_segment red white
rev='±' st='±'
elif [[ -n $rev ]]; then elif [[ -n $st ]]; then
# if any modification
prompt_segment yellow black prompt_segment yellow black
rev='±' st='±'
else else
# if working copy is clean
prompt_segment green black prompt_segment green black
fi fi
echo -n $(hg prompt "⭠ {rev}@{branch}") $st
else
st=""
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
branch=$(hg id -b 2>/dev/null)
if `hg st | grep -Eq "^\?"`; then
prompt_segment red black
st='±'
elif `hg st | grep -Eq "^(M|A)"`; then
prompt_segment yellow black
st='±'
else
prompt_segment green black
fi
echo -n "⭠ $rev@$branch" $st
fi fi
echo -n $(hg prompt "⭠ {rev}@{branch}") $rev
fi fi
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment