Mercurial > dotfiles
diff .shell.d/50.vcs_functions.sh @ 363:51aaf8bcd6ec
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.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 11 Sep 2015 09:53:34 -0400 |
parents | 901e85174513 |
children | 354d05616d65 |
line wrap: on
line diff
--- 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