Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _cvs update.



This update _cvs.

* TZ manipulations are abolished by using stat -g.
* Use [[ -prefix */ ]]. (This depends on 7344.)
* Some internal restructurings.

Index: Completion/User/_cvs
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_cvs,v
retrieving revision 1.1.1.2
diff -u -F^( -r1.1.1.2 _cvs
--- _cvs	1999/08/01 14:48:47	1.1.1.2
+++ _cvs	1999/08/13 15:15:49
@@ -47,14 +47,14 @@
       commit|ci|com) # "+nlRm:fF:r:"
 	_complete_opts n '' l '' R '' m: "$complete_m" f '' F: _files \
 	  r: "$complete_r" ||
-	_cvstargets_modified
+	_cvsmodified
 	;;
       diff|di|dif) # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
 	_complete_opts a '' b '' c '' d '' e '' f '' h '' i '' l '' n '' p '' \
 	  s '' t '' u '' w '' 0 '' 1 '' 2 '' 3 '' 4 '' 5 '' 6 '' 7 '' 8 '' \
 	  9 '' B '' H '' N '' R '' C: '' D: "$complete_D" F: '' I: '' L: '' \
 	  U: '' V: '' W: '' k: "$complete_k" r: "$complete_r" ||
-	_cvstargets_modified || _cvstargets
+	_cvsmodified || _cvstargets
 	;;
       edit) # "+lRa:"
 	_complete_opts l '' R '' a: 'compadd edit unedit commit all none' ||
@@ -174,8 +174,7 @@
 }
 
 _cvsprefix () {
-  #if [[ -prefix */ ]]; then
-  if [[ x"$PREFIX" == x*/* ]]; then
+  if [[ -prefix */ ]]; then
     qpref="${PREFIX%/*}/"
     pref=$~qpref
   else
@@ -184,56 +183,55 @@
   fi
 }
 
-_cvsdirentries () {
-  setopt localoptions nullglob unset
-  if [[ -f ${pref}CVS/Entries ]]; then
-    entries=(${${${(M)${(f)"$(<${pref}CVS/Entries)"}:#D/*}#D/}%%/*})
-  else
-    entries=()
-  fi
+_cvsentries_dir () {
+  entries=($entries ${${${(M)rawentries:#D/*}#D/}%%/*})
 }
 
-_cvsentries () {
-  setopt localoptions nullglob unset
-  if [[ -f ${pref}CVS/Entries ]]; then
-    entries=(${${${${(f)"$(<${pref}CVS/Entries)"}:#D}#(D|)/}%%/*})
-  else
-    entries=()
-  fi
+_cvsentries_plain () {
+  entries=($entries ${${${(M)rawentries:#/*}#/}%%/*})
 }
 
 _cvsentries_modified () {
   if (( $+_cvsentries_modified_disable_stat )) ||
     ! { zmodload -e stat || zmodload stat }; then
-    _cvsentries
+    _cvsentries_plain
     return
   fi
 
-  entries=()
-  local line Entries
-  typeset -A mtime
+  local ents pats
+  ents=(${${${${(M)rawentries:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#})
+  pats=(${${${(f)"$(LANG=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${pref}*(D))"}##*/}/ //})
+  eval 'ents=(${ents:#('${(j:|:)pats:q}')})'
+  entries=($entries ${ents%%/*})
+}
 
-  if [[ -f "${pref}CVS/Entries" ]]; then
-    Entries="$(<${pref}CVS/Entries)"
-  else
-    return
+_cvsdirentries () {
+  entries=()
+  if [[ -f ${pref}CVS/Entries ]]; then
+    local rawentries
+    rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+    _cvsentries_dir
   fi
-
-  local LANG=C
-  local OLDTZ="$TZ"; if ! (( $+TZ )); then unset OLDTZ; fi; export TZ=GMT
+}
 
-  mtime=(${(s:/:)${(j:/:)${${${${(M)${(f)Entries}:#/*}#/}%/*/*}/\\/*\\///}}})
-  entries=(${${${(M)${(f)Entries}:#D/*}#D/}%%/*})
-  builtin stat -n +mtime -F '%a %b %e %T %Y' "$pref${(@k)^mtime}" |
-  while read line
-  do
-    line=${line#$pref}
-    if [[ x"$mtime[${line%% *}]" != x"${line#* }" ]]; then
-      entries=($entries "${line%% *}")
-    fi
-  done
+_cvsentries () {
+  entries=()
+  if [[ -f ${pref}CVS/Entries ]]; then
+    local rawentries
+    rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+    _cvsentries_plain
+    _cvsentries_dir
+  fi
+}
 
-  if (( $+OLDTZ )); then TZ="$OLDTZ"; else unset TZ; fi
+_cvsmodentries () {
+  entries=()
+  if [[ -f ${pref}CVS/Entries ]]; then
+    local rawentries
+    rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+    _cvsentries_modified
+    _cvsentries_dir
+  fi
 }
 
 _cvsdirs () {
@@ -264,11 +262,11 @@
   fi
 }
 
-_cvstargets_modified () {
+_cvsmodified () {
   local qpref pref entries
   _cvsprefix
   if [[ -d ${pref}CVS ]]; then
-    _cvsentries_modified
+    _cvsmodentries
     case $#entries in
       0) false;;
       1) compgen -g "${entries:q}";;
-- 
Tanaka Akira



Messages sorted by: Reverse Date, Date, Thread, Author