Optimize _lp_svn_branch

This commit is contained in:
Olivier Mengué 2013-05-22 23:42:55 +02:00
parent 73599b07e9
commit 56cef06883

View File

@ -832,18 +832,15 @@ _lp_svn_branch()
[[ "$LP_ENABLE_SVN" != 1 ]] && return [[ "$LP_ENABLE_SVN" != 1 ]] && return
local root local root
local url local url
local result
eval $(LANG=C LC_ALL=C svn info 2>/dev/null | sed -n 's/^URL: \(.*\)/url="\1"/p;s/^Repository Root: \(.*\)/root="\1"/p' ) eval $(LANG=C LC_ALL=C svn info 2>/dev/null | sed -n 's/^URL: \(.*\)/url="\1"/p;s/^Repository Root: \(.*\)/root="\1"/p' )
if [[ "$root" == "" ]]; then [[ -z "$root" ]] && return
return
fi
# Make url relative to root # Make url relative to root
url="${url:${#root}}" url="${url:${#root}}"
if [[ "$url" == */trunk* ]] ; then if [[ "$url" == */trunk* ]] ; then
echo -n trunk echo -n trunk
else else
result=$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root") _lp_escape "$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root")"
echo -n $result # FIXME should be: echo -n $(_lp_escape "${result}")
fi fi
} }