From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3294 invoked from network); 18 May 2009 02:34:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 18 May 2009 02:34:30 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 5313 invoked from network); 18 May 2009 02:34:25 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 May 2009 02:34:25 -0000 Received: (qmail 10342 invoked by alias); 18 May 2009 02:34:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26970 Received: (qmail 10331 invoked from network); 18 May 2009 02:34:18 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 18 May 2009 02:34:18 -0000 Received: from QMTA11.westchester.pa.mail.comcast.net (qmta11.westchester.pa.mail.comcast.net [76.96.59.211]) by bifrost.dotsrc.org (Postfix) with ESMTP id E94AA801E289 for ; Mon, 18 May 2009 04:34:03 +0200 (CEST) Received: from OMTA06.westchester.pa.mail.comcast.net ([76.96.62.51]) by QMTA11.westchester.pa.mail.comcast.net with comcast id sj2L1b00716LCl05Bqa3x1; Mon, 18 May 2009 02:34:03 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA06.westchester.pa.mail.comcast.net with comcast id sqa31b0015M2Np63Sqa3Xc; Mon, 18 May 2009 02:34:03 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id DBB2CB30144; Sun, 17 May 2009 22:34:01 -0400 (EDT) Received: by lwm.klanderman.net (Postfix, from userid 500) id C76349FC61B; Sun, 17 May 2009 22:34:01 -0400 (EDT) From: Greg Klanderman To: zsh-workers@sunsite.dk Cc: Vincent Lefevre , 512308-forwarded@bugs.debian.org Subject: PATCH: Re: Bug#512308: zsh: out-of-date completions for svn revert Reply-To: gak@klanderman.net Date: Sun, 17 May 2009 22:34:01 -0400 In-Reply-To: <20090119150602.GA3752@scru.org> (Clint Adams's message of "Mon, 19 Jan 2009 15:06:02 +0000") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (linux) References: <20090119145520.GA29602@vin.lip.ens-lyon.fr> <20090119150602.GA3752@scru.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Virus-Scanned: ClamAV 0.94.2/9365/Sat May 16 14:41:29 2009 on bifrost X-Virus-Status: Clean --=-=-= >>>>> Clint Adams writes: > On Mon, Jan 19, 2009 at 03:55:20PM +0100, Vincent Lefevre wrote: >> Once completions have been done, information for "svn revert" >> can become out-of-date. Let's see the problem on an example, >> in an empty working copy: >> >> $ touch blah1 >> $ svn add blah1 >> $ svn revert [TAB] >> >> This one completes to "svn revert blah1" as expected. Type [Enter]. >> >> $ touch blah2 >> $ svn add blah2 >> $ svn revert [TAB] >> >> This one completes to "svn revert blah1" again, while it should have >> completed to "svn revert blah2". > Is there a timestamp that the 'svn add' will touch so we could compare it > with the cache age? Here's a patch to fix this svn completion problem reported back in January [workers #26367].. things were even worse than it appeared because the key used for caching 'svn status' output for a directory was the relative directory path, which would usually be '.' so if you cd'd around it would have exhibited worse problems. It's now caching based on the directory device and inode, and using the mtime of the .svn/entries file to invalidate a cached entry. cheers, Greg --=-=-= Content-Disposition: inline; filename=zsh-svn-cache.patch Content-Description: patch Index: Completion/Unix/Command/_subversion =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_subversion,v retrieving revision 1.26 diff -u -r1.26 _subversion --- Completion/Unix/Command/_subversion 17 May 2009 18:23:10 -0000 1.26 +++ Completion/Unix/Command/_subversion 18 May 2009 02:19:15 -0000 @@ -22,7 +22,7 @@ ;; 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 @@ 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] )) || --=-=-=--