hg_ps1() { if $(hg st > /dev/null 2>&1); then hg log -l1 -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 $(hg_ps2)$(hg_ps1)\w $ '