From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22927 invoked from network); 9 Jan 2000 02:23:36 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Jan 2000 02:23:36 -0000 Received: (qmail 27324 invoked by alias); 9 Jan 2000 02:23:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9273 Received: (qmail 27317 invoked from network); 9 Jan 2000 02:23:29 -0000 To: zsh-workers@sunsite.auc.dk Subject: PATCH: _cvs update MIME-Version: 1.0 (generated by AKEMI 1.13.2 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCQTA0Y0s8GyhCIg==?=) Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 09 Jan 2000 11:23:27 +0900 Message-ID: User-Agent: Chao-gnus/6.12.5 AKEMI/1.13.2 (=?ISO-2022-JP?B?GyRCQTAbKEI=?= =?ISO-2022-JP?B?GyRCNGNLPBsoQg==?=) FLAM-DOODLE/1.12.6 (=?ISO-2022-JP?B?GyRCM3cbKEI=?= 10R4.0/5.0) Emacs/20.4 (sparc-sun-solaris2.6) MULE/4.0 (HANANOEN) This updates _cvs. * Use normalized cvs subcommand as a context. * Detect .cvspass modification. Index: Completion/User/_cvs =================================================================== RCS file: /projects/zsh/zsh/Completion/User/_cvs,v retrieving revision 1.1.1.23 diff -u -r1.1.1.23 _cvs --- Completion/User/_cvs 1999/12/16 14:26:20 1.1.1.23 +++ Completion/User/_cvs 2000/01/09 02:17:08 @@ -21,6 +21,7 @@ (( $+functions[_cvs_command] )) || _cvs_command () { + local cmd typeset -A cmds cmds=(add " ad new " admin " adm rcs " annotate " ann " checkout " co get " commit " ci com " diff " di dif " @@ -37,15 +38,16 @@ else local curcontext="$curcontext" - curcontext="${curcontext%:*}:$words[1]" - _cvs_"${${(k)cmds[(R)* $words[1] *]}:-${(k)cmds[(i)$words[1]]}}" + cmd="${${(k)cmds[(R)* $words[1] *]}:-${(k)cmds[(i)$words[1]]}}" + if (( $#cmd )); then + curcontext="${curcontext%:*}:$cmd" + _cvs_$cmd + else + _message "unknown cvs command: $words[1]" + fi fi } -_cvs_ () { - _message "unknown cvs command: $words[1]" -} - # define completion functions for each cvs command (( $+functions[_cvs_add] )) || @@ -388,7 +390,25 @@ (( $+functions[_cvs_root] )) || _cvs_root () { - _tags files && { compadd "$@" $_cvs_roots || _files "$@" -/ } + local cvspassfile id + + typeset -gU _cvs_roots + + if [[ -f "${cvspassfile::=${CVS_PASSFILE:-$HOME/.cvspass}}" ]]; then + if zmodload -e stat; then + id="$(LANG=C builtin stat -g +mtime -F '%Y/%m/%d-%T' "$cvspassfile")" + else + id="$(LANG=C ls -l "$cvspassfile")" + fi + if [[ "$id" != "$_cvs_pass_id" ]]; then + _cvs_roots=($_cvs_roots ${${(f)"$(<$cvspassfile)"}%% *}) + _cvs_pass_id="$id" + fi + fi + + _tags files && { + compadd -M 'r:|[:@./]=* r:|=*' "$@" $_cvs_roots || _files "$@" -/ + } } (( $+functions[_cvs_tempdir] )) || @@ -604,15 +624,6 @@ } # define configuration variables. - -local tmp - -(( $+_cvs_roots )) || -if [[ -f "${tmp::=${CVS_PASSFILE:-$HOME/.cvspass}}" ]]; then - _cvs_roots=(${${(f)"$(<$tmp)"}%% *}) -else - _cvs_roots=() -fi (( $+_cvs_ignore_default )) || _cvs_ignore_default=( -- Tanaka Akira