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

Re: Subversion completion don't work with UTF8 (and other) file names



On 4 May, Peter Stephenson wrote:
> So that goes back to my previous question, what do we actually need to
> change to make it work regardless of locale?

For subcommands, lines starting with three spaces works. For
changelists, we can use svn status --xml. That breaks if the changelist
name needs XML entities (which it only uses for things like &<>") but
you can already confuse it with suitably contrived characters, anyway.

For everything else, it isn't so easy, mainly because we also match
strings like ARG, TARGET, URL etc to find out what to complete after the
option or subcommand. And those get translated. If anyone, is tempted to
try to get further on this, note that svn 1.7 translates slightly more
than 1.6 such as the word "usage".

Oliver

diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 597f232..014b0ac 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -20,7 +20,7 @@ _svn () {
     typeset -gHA _svn_cmds
     if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then
       _svn_cmds=(
-	${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+        ${=${${${(M)${(f)"$(_call_program commands svn help)"}:#   [a-z]*}//[ )]/}//[(,]/:}/(#m)*/${MATCH%%:*} :$MATCH:}
       )
       _store_cache svn-cmds _svn_cmds
     fi
@@ -157,7 +157,7 @@ _svnadmin () {
   if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then
     typeset -gHA _svnadmin_cmds
     _svnadmin_cmds=(
-      ${=${(f)${${"$(_comp_locale; _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+      ${=${${${(M)${(f)"$(_call_program commands svnadmin help)"}:#   [a-z]*}//[ )]/}//[(,]/:}/(#m)*/${MATCH%%:*} :$MATCH:}
     )
   fi
 
@@ -319,7 +319,7 @@ _svn_props() {
 _svn_changelists() {
   local cls
 
-  cls=( ${${${(M)${(f)"$(_comp_locale; _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} )
+  cls=( ${${${(M)${(s.<.)"$(_call_program changelists svn status --xml)"}:#changelist*}#*name=?}%%?>*} )
   compadd "$@" -a cls && return 0
 }
 



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