* PATCH: _cvs update.
@ 1999-08-13 15:22 Tanaka Akira
0 siblings, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 1999-08-13 15:22 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH: _cvs update
@ 2000-01-09 2:23 Tanaka Akira
0 siblings, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 2000-01-09 2:23 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH: _cvs update.
@ 1999-07-29 20:45 Tanaka Akira
0 siblings, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 1999-07-29 20:45 UTC (permalink / raw)
To: zsh-workers
This is _cvs update.
* more cvsignores for _cvsaddp.
* _cvsaddp tries completion without cvsignores if there is no
completion candidates.
* cvs_roots is renamed to _cvs_roots and the definition is moved to
toplevel. Also, its definition is now external command free.
* some code beautification.
--- Completion/User/_cvs- Thu Jul 29 03:00:57 1999
+++ Completion/User/_cvs Fri Jul 30 05:31:49 1999
@@ -142,23 +142,12 @@
return
fi
- case ${+cvs_roots} in
- 0)
- cvs_roots=()
- if [[ -f ~/.cvspass ]]; then
- cvs_roots=(
- $(cut -d ' ' -f 1 ~/.cvspass)
- )
- fi
- ;;
- esac
-
_complete_opts \
H '' Q '' q '' r '' w '' l '' n '' t '' v '' f '' a '' \
b: "compadd /usr/local/bin" \
T: "compadd $TMPPREFIX:h $TMPDIR /tmp" \
e: "compadd vi" \
- d: "compadd $cvs_roots || _files -/" \
+ d: "compadd $_cvs_roots || _files -/" \
z: "compadd 9'" \
s: "_cvs_user_variable" \
||
@@ -198,7 +187,7 @@
_cvsdirentries () {
setopt localoptions nullglob unset
if [[ -f ${pref}CVS/Entries ]]; then
- entries=( ${${${(M)${(f)"$(<${pref}CVS/Entries)"}:#D/*}#D/}%%/*} )
+ entries=(${${${(M)${(f)"$(<${pref}CVS/Entries)"}:#D/*}#D/}%%/*})
else
entries=()
fi
@@ -207,7 +196,7 @@
_cvsentries () {
setopt localoptions nullglob unset
if [[ -f ${pref}CVS/Entries ]]; then
- entries=( ${${${${(f)"$(<${pref}CVS/Entries)"}:#D}#(D|)/}%%/*} )
+ entries=(${${${${(f)"$(<${pref}CVS/Entries)"}:#D}#(D|)/}%%/*})
else
entries=()
fi
@@ -233,8 +222,8 @@
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/}%%/*} )
+ 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
@@ -297,8 +286,8 @@
_cvsentries
setopt localoptions unset
local omit
- omit=( ${pref}*(D:t) )
- eval 'entries=( ${entries:#('${(j:|:)omit:q}')} )'
+ omit=(${pref}*(D:t))
+ eval 'entries=(${entries:#('${(j:|:)omit:q}')})'
compadd -P "$qpref" - ${entries:q} ||
_cvsdirs
else
@@ -313,14 +302,32 @@
_cvsentries
setopt localoptions unset
local omit
- omit=( CVS ${entries:q} ${=cvsignore} )
- [[ -r ~/.cvsignore ]] && omit=( $omit $(<~/.cvsignore) )
- [[ -r ${pref}.cvsignore ]] && omit=( $omit $(<${pref}.cvsignore) )
+ omit=($_cvs_ignore_default ${entries:q} ${=cvsignore})
+ [[ -r ~/.cvsignore ]] && omit=($omit $(<~/.cvsignore))
+ [[ -r ${pref}.cvsignore ]] && omit=($omit $(<${pref}.cvsignore))
compgen -g '*~(*/|)('${(j:|:)omit}')(D)' ||
- { _cvsdirentries; compgen -g '('${(j:|:)entries:q}')(D)' }
+ compgen -g '*~(*/|)('${(j:|:)entries:q}')(D)' ||
+ _cvsdirs
else
_files
fi
}
+
+if (( ! $+_cvs_ignore_default )); then
+ _cvs_ignore_default=(
+ RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
+ '*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
+ '.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
+ core
+ )
+fi
+
+if (( ! $+_cvs_roots )); then
+ if [[ -f ~/.cvspass ]]; then
+ _cvs_roots=(${${(f)"$(<~/.cvspass)"}%% *})
+ else
+ _cvs_roots=()
+ fi
+fi
_cvs "$@"
--
Tanaka Akira
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-01-09 2:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-13 15:22 PATCH: _cvs update Tanaka Akira
-- strict thread matches above, loose matches on Subject: below --
2000-01-09 2:23 Tanaka Akira
1999-07-29 20:45 Tanaka Akira
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).