faster subversion status

Stop as soon as "svn status" shows a change, not needed to walk through
all the changes in the whole repository. For my large repository this is
about twice as fast.

Extract just the information we need from "svn info"
pull/1390/head
Martin Ankerl 2019-06-24 11:28:53 +02:00
parent 838aeabd02
commit 0bafdbbef9
1 changed files with 3 additions and 3 deletions

View File

@ -231,7 +231,7 @@ function p4_prompt_vars {
}
function svn_prompt_vars {
if [[ -n $(svn status 2> /dev/null) ]]; then
if [[ -n $(svn status |head -c1 2> /dev/null) ]]; then
SCM_DIRTY=1
SCM_STATE=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
else
@ -240,8 +240,8 @@ function svn_prompt_vars {
fi
SCM_PREFIX=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
SCM_BRANCH=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return
SCM_CHANGE=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' )
SCM_BRANCH=$(svn info --show-item=url 2> /dev/null | awk -F/ '{ for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return
SCM_CHANGE=$(svn info --show-item=revision 2> /dev/null)
}
# this functions returns absolute location of .hg directory if one exists