about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-09 02:31:55 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-09 02:31:55 +0000
commit56d0011bb13e7390b32a3751b98edf7909132c7a (patch)
tree49fc7ebca886a1f7ff12509a1573ec13daf91970
parentbe76978a0d95e77e6c53dd05bd8cfa889ff65e17 (diff)
downloadzsh-56d0011bb13e7390b32a3751b98edf7909132c7a.tar.gz
zsh-56d0011bb13e7390b32a3751b98edf7909132c7a.tar.xz
zsh-56d0011bb13e7390b32a3751b98edf7909132c7a.zip
zsh-workers/9273
-rw-r--r--Completion/User/_cvs43
1 files changed, 27 insertions, 16 deletions
diff --git a/Completion/User/_cvs b/Completion/User/_cvs
index 8cb20b7c3..908c607b0 100644
--- a/Completion/User/_cvs
+++ b/Completion/User/_cvs
@@ -21,6 +21,7 @@ _cvs () {
 
 (( $+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 @@ _cvs_command () {
   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 @@ _cvs_watchers () {
 
 (( $+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] )) ||
@@ -605,15 +625,6 @@ _cvs_files_unmaintained () {
 
 # 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=(
   RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo