Use default branch on recently created Mercurial repository. (#4985)

After `hg init` command, sometimes Mercurial does not create `.hg/branch` file so we'll use 'default' as fallback, which is the master branch in Mercurial repositories.

Signed-off-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
Victor Torres 2016-05-29 06:25:17 -03:00 committed by Marc Cornellà
parent 73cca94322
commit c195189231

View file

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