After 'hg init' command, sometimes Mercurial do not create .hg/branch file so we'll take 'default' as fallback.

This commit is contained in:
Victor Torres 2016-04-07 18:02:37 -03:00
commit 388b185862

View file

@ -17,7 +17,12 @@ function branch_prompt_info() {
# Mercurial repository
if [[ -d "${current_dir}/.hg" ]]
then
echo '☿' $(<"$current_dir/.hg/branch")
if [[ -f "$current_dir/.hg/branch" ]]
then
echo '☿' $(<"$current_dir/.hg/branch")
else
echo '☿ default'
fi
return;
fi
# Defines path as parent directory and keeps looking for :)