From: Frank Terbeck Date: Fri, 29 Aug 2008 22:04:27 +0000 (+0200) Subject: zshrc: Improve robustness of the bzr backend in vcs_info() X-Git-Tag: 0.3.53~1 X-Git-Url: https://git.grml.org/?a=commitdiff_plain;ds=sidebyside;h=c52121b18d77d83717059a6196994e911a000f56;p=grml-etc-core.git zshrc: Improve robustness of the bzr backend in vcs_info() I just played a little with bzr; calling 'bzr' itself in the prompt is painfully slow. And we do it *twice* for the base directory and the branchname/revision-number. I don't know enough about bzr, to change this. Personally, I would replace the branch-root, by the base directory, that VCS_INFO_detect_by_dir(). The branch name *could* be replaced by ${bzrbase:t}, but since it is retrieved from the same command as the revision-number, so that will not save us a call to 'bzr'... Hints on this one are highly appreciated. Like this, the bzr backend is just too slow to use (for me on my laptop at 1.5GHz). --- diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 23f653b..c3535f2 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1284,12 +1284,10 @@ VCS_INFO_svn_get_data () { # {{{ VCS_INFO_bzr_get_data () { # {{{ local msg bzrbranch bzrbase bzrrevno i j - bzrbase=$(bzr info | sed -rne 's, *branch root: ,,p') - case ${bzrbase} in - .) bzrbase=${PWD} ;; - esac + bzrbase=$(bzr info 2>/dev/null | sed -rne 's, *branch root: ,,p') + bzrbase=$(VCS_INFO_realpath ${bzrbase}) - bzr version-info | while read i j; do + bzr version-info 2> /dev/null | while read i j; do case "${i}" in revno:) bzrrevno=${j} ;; @@ -1330,6 +1328,7 @@ VCS_INFO_detect_by_dir() { VCS_INFO_bzr_detect() { check_com -c bzr || return 1 + vcs_comm[detect_need_file]=branch/format VCS_INFO_detect_by_dir '.bzr' return $? }