hg_ps1() {
if $(hg st > /dev/null 2>&1); then
hg log -r. --template=' {branch}-r{rev}{if(tags," ({tags})")}{if(bookmarks," ({bookmarks})")} '
fi
}
hg_ps2() {
if $(hg st > /dev/null 2>&1); then
basename $(hg root)
fi
}
export PS1='\u@\h\e[32m $(hg_ps2)\e[31m$(hg_ps1)\e[39m\w $ '
######################
# gives command prompt:
# ingo@aeolus trunk default-r22173 (tip) ~/ottd/trunk $
######################