summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_subversion
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-11-15 17:52:02 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-11-15 17:52:02 +0000
commit76e087f4b29ac04afb07e3d655891ee6c10f6145 (patch)
tree7f2009fad2243538e76ba0088b65ff43f896fd0a /Completion/Unix/Command/_subversion
parent51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4 (diff)
downloadzsh-76e087f4b29ac04afb07e3d655891ee6c10f6145.tar.gz
zsh-76e087f4b29ac04afb07e3d655891ee6c10f6145.zip
Greg Klanderman: 27409: subversion and URL paths
Diffstat (limited to 'Completion/Unix/Command/_subversion')
-rw-r--r--Completion/Unix/Command/_subversion63
1 files changed, 44 insertions, 19 deletions
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index b4e47d330..9d6babed5 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -205,32 +205,57 @@ _svn_status() {
(( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} ))
}
-(( $+functions[_svn_urls] )) ||
-_svn_urls() {
+(( $+functions[_svn_remote_paths] )) ||
+_svn_remote_paths() {
local expl remfiles remdispf remdispd suf ret=1
- if [[ -prefix *: ]] && ! _urls &&
- zstyle -T ":completion:${curcontext}:" remote-access
- then
- remfiles=( ${(f)"$(svn list $IPREFIX${PREFIX%%[^./][^/]#} 2>/dev/null)"} )
- compset -P '*/'
- compset -S '/*' || suf=file
- remdispf=(${remfiles:#*/})
- remdispd=(${(M)remfiles:#*/})
- _tags files
- while _tags; do
- while _next_label files expl ${suf:-directory}; do
- [[ -n $suf ]] && compadd -S ' ' -q "$@" "$expl[@]" -d remdispf $remdispf && ret=0
- compadd -S "${suf:+/}" -q "$@" "$expl[@]" -d remdispd ${remdispd%/} && ret=0
- done
- (( ret )) || return 0
+ [[ -prefix *://*/ ]] || return 1
+ zstyle -T ":completion:${curcontext}:" remote-access || return 1
+
+ remfiles=( ${(f)"$(svn list $IPREFIX${PREFIX%%[^./][^/]#} 2>/dev/null)"} )
+ (( $? == 0 )) || return 1
+
+ # you might consider trying to return early if $#remfiles is zero,
+ # but for whatever reason remfiles will always contain at least a
+ # single empty string; that case is handled correctly below.
+
+ compset -P '*/'
+ compset -S '/*' || suf=file
+ remdispf=(${remfiles:#*/})
+ remdispd=(${(M)remfiles:#*/})
+ _tags files
+ while _tags; do
+ while _next_label files expl ${suf:-directory}; do
+ # add files, unless there is a '/' immediately to the right
+ [[ -n $suf ]] &&
+ compadd -S ' ' -q "$@" "$expl[@]" -d remdispf $remdispf && ret=0
+ # add directories; use empty suffix if there is a '/' immediately to the right
+ compadd -S "${suf:+/}" -q "$@" "$expl[@]" -d remdispd ${remdispd%/} && ret=0
done
- else
+ (( ret )) || return 0
+ done
+
+ return 1
+}
+
+(( $+functions[_svn_urls] )) ||
+_svn_urls() {
+ local expl ret=1
+
+ # first try completing a remote path; if successful, we are all done..
+ _svn_remote_paths && return 0
+
+ # allow configuring svn repository locations using the 'urls' zstyle.
+ # always attempt completion of these because then matcher-list styles
+ # which do substring matching will work correctly.
+ _urls -S/ && ret=0
+
+ if [[ ! -prefix *://? ]] ; then
compset -S '[^:]*'
_wanted url-schemas expl 'URL schema' compadd -S '' - \
file:// http:// https:// svn:// svn+ssh:// && ret=0
fi
-
+
return ret
}