From 3453546eaaf73182b9ec2f35192559bbb2a4ca31 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 5 Aug 2012 22:06:54 +0200 Subject: [PATCH] use svn info instead of .svn directories as a svn test, better match regexp --- liquidprompt.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/liquidprompt.bash b/liquidprompt.bash index 67c08cf..0c665f3 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -527,13 +527,15 @@ __hg_branch_color() # For the first level of the repository, gives the repository name __svn_branch() { - if [[ -d ".svn" ]] ; then - root=$(svn info --xml 2>/dev/null | grep "^" | sed "s/^.*\/\([^\/]*\)<\/root>$/\1/") - subrep=$(svn info --xml 2>/dev/null | grep "^" | sed "s/.*\/$root\/\(.*\)<\/url>$/\1/") - branch=$(basename $subrep) - if [[ "$branch" == ""* ]] ; then + infos=$(svn info --xml 2>/dev/null) + ret=$? + if [[ $ret -eq 0 ]] ; then + root=$(echo "$infos" | grep "^" | sed "s/^.*\/\([^\/]*\)<\/root>$/\1/") + subrep=$(echo "$infos" | grep "^" | sed "s/^.*\/$root\/\(.*\)<\/url>$/\1/") + if [[ "$subrep" == *"url>"* ]] ; then echo -n $root else + branch=$(basename $subrep) echo -n $branch fi fi