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 $ '
export TERM=xterm-256color