[base.theme] add support for hg's bookmarks feature

Will conditionally show the branch based on the current bookmark instead
of branch.
pull/1874/head
Oliver Ruben Albertini 2021-04-21 18:06:24 -07:00
parent 7b8dbd39bc
commit 26118d1835
1 changed files with 3 additions and 1 deletions

View File

@ -359,7 +359,9 @@ function hg_prompt_vars {
if [ -f "$HG_ROOT/branch" ]; then 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=$(< "${HG_ROOT}/branch")
local bookmark=${HG_ROOT}/bookmarks.current
[[ -f ${bookmark} ]] && SCM_BRANCH+=:$(< "${bookmark}")
else else
SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}') SCM_BRANCH=$(hg summary 2> /dev/null | grep branch: | awk '{print $2}')
fi fi