From 0bafdbbef9db4f60a5e701d9f82ac126571c91eb Mon Sep 17 00:00:00 2001 From: Martin Ankerl Date: Mon, 24 Jun 2019 11:28:53 +0200 Subject: [PATCH] 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" --- themes/base.theme.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index e9e862e1..7ab5f39c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -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