On new repositories ./hg/branch and .hg/dirstate do not exist. In this case use "hg summary"

pull/378/head
Kovica 2014-12-12 20:32:04 +01:00
parent 324e1edfce
commit 35adbaf7b3
1 changed files with 13 additions and 4 deletions

View File

@ -160,10 +160,19 @@ function hg_prompt_vars {
HG_ROOT=$(get_hg_root) HG_ROOT=$(get_hg_root)
if [ -f $HG_ROOT/branch ]; then
# Mercurial holds it's current branch in .hg/branch file # Mercurial holds it's current branch in .hg/branch file
SCM_BRANCH=$(cat $HG_ROOT/branch) SCM_BRANCH=$(cat $HG_ROOT/branch)
else
SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}')
fi
if [ -f $HG_ROOT/dirstate ]; then
# Mercurial holds various information about the working directory in .hg/dirstate file. More on http://mercurial.selenic.com/wiki/DirState # Mercurial holds various information about the working directory in .hg/dirstate file. More on http://mercurial.selenic.com/wiki/DirState
SCM_CHANGE=$(hexdump -n 10 -e '1/1 "%02x"' $HG_ROOT/dirstate | cut -c-12) SCM_CHANGE=$(hexdump -n 10 -e '1/1 "%02x"' $HG_ROOT/dirstate | cut -c-12)
else
SCM_CHANGE=$(hg summary 2> /dev/null | grep parent: | awk '{print $2}')
fi
} }
function rvm_version_prompt { function rvm_version_prompt {