Mercurial > dotfiles
comparison .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 |
comparison
equal
deleted
inserted
replaced
362:6dd0f2587d74 | 363:51aaf8bcd6ec |
---|---|
123 }'` | 123 }'` |
124 local rev=`svn info | grep Revision | sed 's/.*: /r/'` | 124 local rev=`svn info | grep Revision | sed 's/.*: /r/'` |
125 echo $br $rev | 125 echo $br $rev |
126 return 0 | 126 return 0 |
127 fi | 127 fi |
128 hg branch 2> /dev/null > /dev/null | 128 hginfo=$(hg log -r . -T'{if(activebookmark,"{activebookmark}","{branch}")} {shortest(node)}') |
129 if [ $? = 0 ] ; then | 129 if [ $? = 0 ] ; then |
130 local bm=$(hg book | egrep ' \* ' | awk '{print $2}') | 130 echo "$hginfo" |
131 local br=`hg branch | head -c 10` | |
132 local rid=`hg parents --template '{node}\n' | head -n 1 | head -c 7` | |
133 if [ -z "$bm" ] ; then | |
134 echo "$br $rid" | |
135 else | |
136 echo "$bm $rid" | |
137 fi | |
138 return 0 | 131 return 0 |
139 fi | 132 fi |
140 return 1 | 133 return 1 |
141 } | 134 } |
142 | 135 |