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
local root
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' )
if [[ "$root" == "" ]]; then
return
fi
[[ -z "$root" ]] && return
# Make url relative to root
url="${url:${#root}}"
if [[ "$url" == */trunk* ]] ; then
echo -n trunk
else
result=$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root")
echo -n $result # FIXME should be: echo -n $(_lp_escape "${result}")
_lp_escape "$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root")"
fi
}