From 8edf8a06581667ca33477a864d7f93b2d6e9eccf Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 22 May 2009 15:48:32 +0000 Subject: 26970: Greg Klanderman: _subversion: fix caching. --- ChangeLog | 7 ++++++- Completion/Unix/Command/_subversion | 13 +++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1c73bf5d..fed7e8bbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-05-22 Peter Stephenson + + * 26970: Greg Klanderman: Completion/Unix/Command/_subversion: fix + caching. + 2009-05-22 Clint Adams * 26939: Completion/Unix/Command/_xmms2: clean up xmms2 jump @@ -11748,5 +11753,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.4694 $ +* $Revision: 1.4695 $ ***************************************************** diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 01b2bbb2a..d31f0243a 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -22,7 +22,7 @@ _svn () { ;; args) local cmd args usage - typeset -gHA _cache_svn_status + typeset -gHA _cache_svn_status _cache_svn_mtime cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" if (( $#cmd )); then @@ -193,11 +193,16 @@ _svn_status() { local dir=$REPLY:h local pat="${1:-([ADMR~]|?M)}" - if (( ! $+_cache_svn_status[$dir] )); then - _cache_svn_status[$dir]="$(_call_program files svn status -N $dir)" + zmodload -F zsh/stat b:zstat 2>/dev/null + local key="$(zstat +device $dir):$(zstat +inode $dir)" + local mtime="$(zstat +mtime $dir/.svn/entries)" + + if (( ! $+_cache_svn_status[$key] || _cache_svn_mtime[$key] != mtime )); then + _cache_svn_status[$key]="$(_call_program files svn status -N $dir)" + _cache_svn_mtime[$key]="$mtime" fi - (( ${(M)#${(f)_cache_svn_status[$dir]}:#(#s)${~pat}*$REPLY} )) + (( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} )) } (( $+functions[_svn_urls] )) || -- cgit 1.4.1