.bash/scm.sh

28 lines
743 B
Bash
Raw Permalink Normal View History

2012-05-18 13:46:36 +04:00
if [ `which git 2>/dev/null` ]; then
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf "(%s)" "${b##refs/heads/}";
fi
}
fi
if [ `which hg 2>/dev/null` ]; then
__hg_ps1 ()
{
while [[ ! -d .hg && `pwd` != / ]]; do cd .. ; done
if [[ "`pwd`" != "$HOME" ]]; then
local b="$(cat .hg/branch 2>/dev/null)";
if [ -n "$b" ]; then
printf "(%s)" "${b}";
fi
fi
}
2019-06-17 13:44:55 +03:00
else
__hg_ps1 ()
{
printf ""
}
2012-05-18 13:46:36 +04:00
fi