zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@jaist.ac.jp>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: _cvs update
Date: 09 Jan 2000 11:23:27 +0900	[thread overview]
Message-ID: <rsqbt6w0yqo.fsf@crane.jaist.ac.jp> (raw)

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


             reply	other threads:[~2000-01-09  2:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-09  2:23 Tanaka Akira [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-08-13 15:22 Tanaka Akira
1999-07-29 20:45 Tanaka Akira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=rsqbt6w0yqo.fsf@crane.jaist.ac.jp \
    --to=akr@jaist.ac.jp \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).