Merge branch 'disable_vcs' of ssh://localhost:8480/ldidry/liquidprompt into develop

This commit is contained in:
nojhan 2012-08-16 11:17:12 +02:00
commit a2af9a0b4a
2 changed files with 33 additions and 0 deletions

View File

@ -195,6 +195,9 @@ LP_PROXY_MARK=${LP_PROXY_MARK:-"↥"}
LP_GIT_MARK=${LP_GIT_MARK:-"±"}
LP_MERCURIAL_MARK=${LP_MERCURIAL_MARK:-"☿"}
LP_SUBVERSION_MARK=${LP_SUBVERSION_MARK:-"‡"}
LP_ENABLE_GIT=${LP_ENABLE_GIT:-1}
LP_ENABLE_SVN=${LP_ENABLE_SVN:-1}
LP_ENABLE_HG=${LP_ENABLE_HG:-1}
LP_COLOR_PATH=${LP_COLOR_PATH:-$BOLD_WHITE}
LP_COLOR_PATH_ROOT=${LP_COLOR_PATH_ROOT:-$BOLD_YELLOW}
@ -520,6 +523,9 @@ _lp_return_value()
# Get the branch name of the current directory
_lp_git_branch()
{
if [[ $LP_ENABLE_GIT == 0 ]] ; then
return ""
fi
if git rev-parse --git-dir >/dev/null 2>&1 && [[ ! -z "$(git branch)" ]] ; then
echo -n "$(git branch 2>/dev/null | sed -n '/^\*/s/^\* //p;')"
fi
@ -533,6 +539,9 @@ _lp_git_branch()
# Add the number of pending commits and the impacted lines.
_lp_git_branch_color()
{
if [[ $LP_ENABLE_GIT == 0 ]] ; then
return ""
fi
command -v git >/dev/null 2>&1 || return 1;
local branch
branch=$(_lp_git_branch)
@ -578,6 +587,9 @@ _lp_git_branch_color()
# Get the branch name of the current directory
_lp_hg_branch()
{
if [[ $LP_ENABLE_HG == 0 ]] ; then
return ""
fi
local branch
branch="$(hg branch 2>/dev/null)"
if [[ $? -eq 0 ]] && [[ ! -z "$(hg branch)" ]] ; then
@ -591,6 +603,9 @@ _lp_hg_branch()
# - TODO: yellow if there is some commits not pushed
_lp_hg_branch_color()
{
if [[ $LP_ENABLE_HG == 0 ]] ; then
return ""
fi
command -v hg >/dev/null 2>&1 || return 1;
local branch
local ret
@ -611,6 +626,9 @@ _lp_hg_branch_color()
# For the first level of the repository, gives the repository name
_lp_svn_branch()
{
if [[ $LP_ENABLE_SVN == 0 ]] ; then
return ""
fi
local infos
local ret
infos=$(svn info --xml 2>/dev/null)
@ -637,6 +655,9 @@ _lp_svn_branch()
# informations are only displayed for the CURRENT directory.
_lp_svn_branch_color()
{
if [[ $LP_ENABLE_SVN == 0 ]] ; then
return ""
fi
command -v svn >/dev/null 2>&1 || return 1;
local branch
branch=$(_lp_svn_branch)

View File

@ -28,4 +28,16 @@ LP_PATH_KEEP=2
# set to 1 if you want to always see the hostname
LP_HOSTNAME_ALWAYS=0
# Do you want to use the git special features ?
# Recommended value is 1
LP_ENABLE_GIT=1
# Do you want to use the svn special features ?
# Recommended value is 1
LP_ENABLE_SVN=1
# Do you want to use the mercurial special features ?
# Recommended value is 1
LP_ENABLE_HG=1
# vim: set et sts=4 sw=4 tw=120 ft=sh: