From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14041 invoked from network); 4 Oct 2000 05:08:21 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Oct 2000 05:08:21 -0000 Received: (qmail 11544 invoked by alias); 4 Oct 2000 05:07:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12872 Received: (qmail 11536 invoked from network); 4 Oct 2000 05:07:46 -0000 To: zsh-workers@sunsite.auc.dk Subject: _cvs update MIME-Version: 1.0 (generated by REMI 1.14.3 - "Matsudai") Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 04 Oct 2000 14:03:39 +0900 Message-ID: User-Agent: T-gnus/6.14.5 (based on Gnus v5.8.7) (revision 03) REMI/1.14.3 (Matsudai) Deisui/1.14.0 (Kikuhime) APEL/10.2 Emacs/20.7 (i386-unknown-openbsd2.7) MULE/4.0 (HANANOEN) This patch updates _cvs. * expand cvsroot specified in command line to fix following error. % cvs -d ~/.cvsroot import cvs [checkout aborted]: CVSROOT ~/.cvsroot must be an absolute pathname module name * Subcommand list are now generated from `cvs --help-commands' and `cvs --help-synonyms'. * Remote modules are now completed. * The second argument of `cvs import' (vendor branch) is completed. * use _call to call cvs. Index: Completion/User/_cvs =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/User/_cvs,v retrieving revision 1.12 diff -u -r1.12 _cvs --- Completion/User/_cvs 2000/08/01 08:27:18 1.12 +++ Completion/User/_cvs 2000/10/04 05:04:04 @@ -36,24 +36,26 @@ (( $+functions[_cvs_command] )) || _cvs_command () { - local cmd cvsroot="${opt_args[-d]:Q}" - typeset -A cmds - cmds=(add " ad new " admin " adm rcs " annotate " ann " - checkout " co get " commit " ci com " diff " di dif " - edit "" editors "" export " exp ex " - history " hi his " import " im imp " init "" - log " lo rlog " login " logon lgn " logout "" - rdiff " patch pa " release " re rel " remove " rm delete " - status " st stat " rtag " rt rfreeze " tag " ta freeze " - unedit "" update " up upd " watch "" - watchers "") + local cmd cvsroot="$CVSROOT" + [[ -f CVS/Root ]] && cvsroot="$(&1)"}:# *}/(#b) #([a-z]##) */$match[1] + }}} + ${(f)${(F)${${(M)${(f)"$(_call synonyms cvs --help-synonyms 2>&1)"}:# *}/(#b) #([a-z]#) #([a-z]#) ([a-z]#)/$match[1] + $match[2] $match[3] }}} + ) + fi if (( CURRENT == 1 )); then - _tags commands && { compadd "$@" -k cmds || compadd "$@" ${(kv)=cmds} } + _tags commands && { compadd "$@" -k _cvs_cmds || compadd "$@" ${(kv)=_cvs_cmds} } else local curcontext="$curcontext" - cmd="${${(k)cmds[(R)* $words[1] *]}:-${(k)cmds[(i)$words[1]]}}" + cmd="${${(k)_cvs_cmds[(R)* $words[1] *]}:-${(k)_cvs_cmds[(i)$words[1]]}}" if (( $#cmd )); then curcontext="${curcontext%:*:*}:cvs-${cmd}:" _cvs_$cmd @@ -355,13 +357,13 @@ # "+Qqdb:m:I:k:W:" _arguments -s \ '-d[use file modification time]' \ - '-b+[specify vendor branch]:branch:' \ + '-b+[specify vendor branch]:branch:(1.1.3)' \ '-m+[message]:message:_cvs_m' \ '*-I+[ignore files]:name:_files' \ '-k+[keyword]:keyword substitution:_cvs_k' \ '*-W+[wrapper specification]:spec:_files' \ ':repository:_cvs_modules' \ - ':vendor tag:' \ + ':vendor tag:_cvs_vendor_branches' \ ':release tag:' } @@ -555,6 +557,11 @@ '*:file:_cvs_files' } +(( $+functions[_cvs_version] )) || +_cvs_version () { + false +} + (( $+functions[_cvs_loadstat] )) || _cvs_loadstat () { zstyle -t ":completion:${curcontext}:" disable-stat && return 1 @@ -584,7 +591,9 @@ fi _tags files && { - compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || _files "$@" -/ + compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || { + compset -P ':(local|fork):'; _files "$@" -W / -/ + } } } @@ -638,43 +647,163 @@ (( $+functions[_cvs_modules] )) || _cvs_modules () { - local root="$CVSROOT" expl - [[ -f CVS/Root ]] && root=$(&/dev/null + cd $d + mkdir CVS >&/dev/null + print -r - "$cvsroot" > CVS/Root + print "$dir" > CVS/Repository + print D > CVS/Entries + CVS_IGNORE_REMOTE_ROOT= cvs "$@" + cd $OLDPWD + rm -rf $d +} + +# _cvs_remote_directories cvsroot directory [variable] +(( $+functions[_cvs_remote_directories] )) || +_cvs_remote_directories () { + local root="$1" dir="$2" subdirs + shift 2 + subdirs=(${${(M)${(f)"$(_call directories _cvs_run "$root" "$dir" update -r00 -d -p 2>&1)"}:#* New directory \`*\' -- ignored}/(#b)*\`(*)\'*/$match[1]}) + if (( $# )); then + eval "$1=(\"\$subdirs[@]\")" + else + if (( $#subdirs )); then + print -lr - $subdirs + fi + fi +} + +(( $+functions[_cvs_vendor_branches] )) || +_cvs_vendor_branches () { + local expl vendor_branch + if [[ -n $opt_args[-b] ]]; then + _cvs_extract_vendor_branch -b "$opt_args[-b]" "$cvsroot" "$line[1]" \ + vendor_branch + else + _cvs_extract_vendor_branch "$cvsroot" "$line[1]" vendor_branch + fi + if (( $#vendor_branch )); then + _wanted values expl 'vendor branch' compadd -a vendor_branch + else + _message 'vendor branch' fi } +# _cvs_extract_vendor_branch [-b numeric-branch] cvsroot directory [variable] +(( $+functions[_cvs_extract_vendor_branch] )) || +_cvs_extract_vendor_branch () { + local numeric='1\.1\.1' + if [[ $1 = -b ]]; then + numeric="${2//./\\.}" + shift 2 + fi + local root="$1" dir="$2" + shift 2 + + local vtags + vtags=($( + _call tags _cvs_run "$root" "$dir" -Q log -h 2>/dev/null | + sed -ne $'/^symbolic names:/{ +n +:loop +/^[^ \t]/d +/: '"$numeric"$'$/b found +n +b loop +:found +s/^[ \t]*\\(.*\\): '"$numeric"$'$/\\1/p +n +/^[ \t]/b found +q +}')) + if (( $# )); then + eval "$1=(\"\$vtags[@]\")" + else + if (( $#vtags )); then + print -lr - "$vtags[@]" + fi + fi +} + (( $+functions[_cvs_revisions] )) || _cvs_revisions () { - local root="$CVSROOT" expl - [[ -f CVS/Root ]] && root=$(