* minor tweak to _subversion remote path completion
@ 2009-11-18 21:18 Greg Klanderman
0 siblings, 0 replies; only message in thread
From: Greg Klanderman @ 2009-11-18 21:18 UTC (permalink / raw)
To: Zsh list
This follows on to my previous patch:
Add a typeset -A that the _arguments documentation says is required:
| A function calling _arguments with at least one action containing a
| '->string' therefore must declare appropriate local parameters:
| local context state line
| typeset -A opt_args
| to avoid _arguments from altering the global environment.
Add support for the special '^/path/..' style repository paths which
I didn't even know about until making the claim that remote path
completion was now complete to a friend.
thanks,
Greg
Index: Completion/Unix/Command/_subversion
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_subversion,v
retrieving revision 1.29
diff -u -r1.29 _subversion
--- Completion/Unix/Command/_subversion 15 Nov 2009 17:52:02 -0000 1.29
+++ Completion/Unix/Command/_subversion 18 Nov 2009 21:16:57 -0000
@@ -2,6 +2,7 @@
_svn () {
local curcontext="$curcontext" state line expl ret=1
+ typeset -A opt_args
_arguments -C \
'(-)--help[print help information]' \
@@ -207,12 +208,20 @@
(( $+functions[_svn_remote_paths] )) ||
_svn_remote_paths() {
- local expl remfiles remdispf remdispd suf ret=1
+ local expl remfiles remdispf remdispd suf ret=1 pfx='\^/' sub='^/'
- [[ -prefix *://*/ ]] || return 1
+ # prefix must match a valid repository path format, either standard style
+ # schema://host/path/.. or ^/path/.. specifying a path relative to the
+ # root of the working directory repository. In the second form, allow the
+ # leading '^' be escaped in case the user has the extendedglob option set.
+ [[ -prefix *://*/ ]] ||
+ [[ -f .svn/entries && ( -prefix '^/' || -prefix '\^/' ) ]] ||
+ return 1
+
+ # return if remote access is not permitted
zstyle -T ":completion:${curcontext}:" remote-access || return 1
- remfiles=( ${(f)"$(svn list $IPREFIX${PREFIX%%[^./][^/]#} 2>/dev/null)"} )
+ remfiles=( ${(f)"$(svn list $IPREFIX${${PREFIX%%[^/]#}/#$pfx/$sub} 2>/dev/null)"} )
(( $? == 0 )) || return 1
# you might consider trying to return early if $#remfiles is zero,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-11-18 21:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-18 21:18 minor tweak to _subversion remote path completion Greg Klanderman
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).