From a0594fc0b671d5dabc0eda312a86ebc3ea0b7094 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 31 Aug 2008 21:40:01 +0200 Subject: [PATCH] zshrc: Fixes for svk in vcs_info() --- debian/changelog | 4 +++- etc/zsh/zshrc | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index b0f8311..8fab55e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,10 @@ grml-etc-core (0.3.54) unstable; urgency=low bzr itself; it is disabled by default. * zshrc: Fix in svn backend of vcs_info(), doc updates and a new style to configure the %b replacement in formats for svn and bzr + * zshrc: Actually tried svk myself; including vcs_info() fixes from + that test. - -- Frank Terbeck Sun, 31 Aug 2008 16:04:47 +0200 + -- Frank Terbeck Sun, 31 Aug 2008 21:35:42 +0200 grml-etc-core (0.3.53) unstable; urgency=low diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index bc2616f..aecf3d9 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1073,7 +1073,7 @@ fi # The default values for these in all contexts are: # promptformat " (%s)-[%b|%a]-" # promptactionformat " (%s)-[%b]-" -# branchformat "%b:%r" (for bzr and svn) +# branchformat "%b:%r" (for bzr, svn and svk) # enable true # disable (empty list) # use-simple false @@ -1282,10 +1282,9 @@ VCS_INFO_svk_get_data () { # {{{ local msg svkbranch svkbase svkbase=${vcs_comm[basedir]} - svkbranch=${svkbase##* - } - svkbase=${svkbase%% - *} + + zstyle -s ":vcs_info:${vcs}" branchformat svkbranch || svkbranch="%b:%r" + zformat -f svkbranch "${svkbranch}" "b:${vcs_comm[branch]}" "r:${vcs_comm[revision]}" msg=$(VCS_INFO_format) zformat -f msg "${msg}" "a:" "b:${svkbranch}" "s:${vcs}" "r:${svkbase:t}" "R:${svkbase}" @@ -1431,14 +1430,35 @@ VCS_INFO_mtn_detect() { } VCS_INFO_svk_detect() { - local basedir + setopt localoptions noksharrays + local -a info check_com -c svk || return 1 [[ -f ~/.svk/config ]] || return 1 - basedir=$(awk '/: *$/ { sub(/^ */,"",$0); sub(/: *$/,"",$0); if (match("'${PWD}'", $0"(/|$)")) { print $0; d=1; } } /depotpath/ && d == 1 { sub(".*/","",$0); r=$0 } /revision/ && d == 1 { print r ":" $2; exit 1 }' ~/.svk/config) && return 1 - - vcs_comm[basedir]=${basedir} + info=( + $(awk ' + /: *$/ { + sub(/^ */,"",$0); + sub(/: *$/,"",$0); + if (match("'${PWD}'", $0"(/|$)")) { + print $0; d=1; + } + } + /depotpath/ && d == 1 { + sub(".*/","",$0); + r=$0 + } + /revision/ && d == 1 { + print r "\n" $2; + exit 1 + }' ~/.svk/config + ) + ) && return 1 + + vcs_comm[basedir]=${info[1]} + vcs_comm[branch]=${info[2]} + vcs_comm[revision]=${info[3]} return 0 } -- 2.1.4