1304ed8d2521e452615bcf7563700018443f5470

Author
Brice Dutheil <brice.dutheil@gmail.com>
Committer
Brice Dutheil <brice.dutheil@gmail.com>
Date

Message

Report the SVN need upgrade

This happen when subversion 1.7+ is used on a repository created with subversion up to 1.6

Diff

 1diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
 2index d8fc539899285c2c67add06415d6e6356ce88cb1..1027bcac27adffdbe85762d4a604c6701ce3637a 100644
 3--- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh
 4+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
 5@@ -10,7 +10,7 @@
 6 # *** IMPORTANT *** DO NO USE with the simple svn plugin, this plugin acts as a replacement of it.
 7 
 8 function parse_svn() {
 9-    info=$(svn info 2> /dev/null) || return
10+	info=$(svn info 2>&1) || return; # capture stdout and stdout
11     in_svn=true
12 	repo_need_upgrade="$(svn_repo_need_upgrade $info)"
13     svn_branch_name="$(svn_get_branch_name $info)"
14@@ -22,7 +22,13 @@ function parse_svn() {
15 function svn_prompt_info() {
16     eval parse_svn
17 
18-    if [ ${in_svn} ]; then
19+	if [ ! -z $repo_need_upgrade ]; then
20+		echo $ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX$ZSH_PROMPT_BASE_COLOR\
21+$repo_need_upgrade\
22+$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR
23+	fi
24+
25+    if [[ ${in_svn} == true && -z $repo_need_upgrade ]]; then
26         echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
27 $ZSH_THEME_REPO_NAME_COLOR${svn_branch_name}\
28 $ZSH_PROMPT_BASE_COLOR${svn_dirty}\
29@@ -34,8 +40,8 @@ $ZSH_PROMPT_BASE_COLOR"
30 
31 function svn_repo_need_upgrade() {
32 	info=$1
33-	[ -z "${info}" ] && info=$(svn info 2> /dev/null)
34-	[ "${info}" = "E155036" ] && echo "upgrade repo with svn upgrade"
35+	[ -z "${info}" ] && info=$(svn info 2>&1)
36+	if grep -q "E155036" <<< $info; then echo "E155036: upgrade repo with svn upgrade"; fi
37 }
38 
39 function svn_get_branch_name() {
40@@ -61,4 +67,4 @@ function svn_get_revision() {
41 function svn_dirty_choose() {
42     svn status | grep -E '^\s*[ACDIM!?L]' > /dev/null 2>/dev/null && echo $ZSH_THEME_SVN_PROMPT_DIRTY && return
43     echo $ZSH_THEME_SVN_PROMPT_CLEAN
44-}
45+}