# HG changeset patch # User Augie Fackler # Date 1441979614 14400 # Node ID 51aaf8bcd6ec7541aaf7f9b97a121e9881c0b549 # Parent 6dd0f2587d74c197b6dca88d9323150508ea500b vcs_functions: fix vcs_current_branch to use hg templating This takes it from 4 hg invocations to 1, and skips a bunch of pipelines. diff --git a/.shell.d/50.vcs_functions.sh b/.shell.d/50.vcs_functions.sh --- a/.shell.d/50.vcs_functions.sh +++ b/.shell.d/50.vcs_functions.sh @@ -125,16 +125,9 @@ function vcs_current_branch() { echo $br $rev return 0 fi - hg branch 2> /dev/null > /dev/null + hginfo=$(hg log -r . -T'{if(activebookmark,"{activebookmark}","{branch}")} {shortest(node)}') if [ $? = 0 ] ; then - local bm=$(hg book | egrep ' \* ' | awk '{print $2}') - local br=`hg branch | head -c 10` - local rid=`hg parents --template '{node}\n' | head -n 1 | head -c 7` - if [ -z "$bm" ] ; then - echo "$br $rid" - else - echo "$bm $rid" - fi + echo "$hginfo" return 0 fi return 1