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

Re: Patch for completion with svn 1.5.0



Peter Stephenson wrote:
> On Wed, 30 Jan 2008 15:11:33 +0000
> Peter Stephenson <pws@xxxxxxx> wrote:
>   
>> On Wed, 30 Jan 2008 13:37:54 +0000
>> Christopher Key <cjk32@xxxxxxxxx> wrote:
>>     
>>> The output of,
>>> # svn help COMMAND
>>> has changed slightly between 1.4.x and 1.5.0.  The attached patch deals
>>> with this.
>>>       
>> Thanks, this looks useful.  Your patch got line-wrapped half-way up Milton
>> Road, so I've reconstructed it slightly.  Does the following look right?
>> (It survived a half-hearted test.)
>>
>> I also patched svnadmin help the same way; does this fix Vincent's problem?
>> (Again, it seemed to do something.)  I'm doing this from ignorance,
>> however, so if I've broken something I wouldn't know.
>>     
>
> A bit of probing suggests the following would be safer.  I'd like to get
> this right before releasing 4.3.5 in the next day or two.
>
> Index: Completion/Unix/Command/_subversion
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_subversion,v
> retrieving revision 1.24
> diff -u -r1.24 _subversion
> --- Completion/Unix/Command/_subversion	19 Apr 2007 20:37:04 -0000	1.24
> +++ Completion/Unix/Command/_subversion	31 Jan 2008 12:37:34 -0000
> @@ -30,7 +30,7 @@
>  
>          usage=${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
>          args=(
> -          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"##*Valid options:}:#* :*}%% #:*}/ arg/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
> +          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"##*Valid options:}:#* :*}%% #:*}/ (?:arg|ARG|arg)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
>          )
>  
>          case $cmd in;
> @@ -148,7 +148,7 @@
>  
>          usage=${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd }
>          args=(
> -          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"##*Valid options:}:#*:*}%% #:*}/ arg/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
> +          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"##*Valid options:}:#* :*}%% #:*}/ (?:arg|ARG|arg)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
>          )
>          if [[ $_svnadmin_subcmd_usage == *REPOS_PATH* ]]; then
>            args+=( ":path:_files -/" )
>
>   
Apologies, I'm not actually subscribed the the zsh-users mailing list,
so have only just caught up on the prior emails via the archive.

I thought I'd tested this with the old version of svn, but hadn't
actually managed to (the command being called by the completion logic
was still version 1.5).  The ?: in the pattern is a perl thing to tell
it not store the result of the match grouped by the brackets, but would
appear not apply to shell scripting.  Instead, "arg" should be replaced
simply with "(arg|ARG)".  I've attached a patch for this.  There are a
few other oddities with svn 1.5 too, I'll have a look and see if I can
deal with any of them.

Regards,

Chris
--- Completion/Unix/Command/_subversion~	2007-03-19 13:02:49.000000000 +0000
+++ Completion/Unix/Command/_subversion	2008-01-31 13:36:12.000000000 +0000
@@ -30,7 +30,7 @@
 
         usage=${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
         args=(
-          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"##*Valid options:}:#* :*}%% #:*}/ arg/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
+          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"##*Valid options:}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
         )
 
         case $cmd in;
@@ -142,7 +142,7 @@
 
         usage=${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd }
         args=(
-          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"##*Valid options:}:#*:*}%% #:*}/ arg/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
+          ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"##*Valid options:}:#*:*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
         )
         if [[ $_svnadmin_subcmd_usage == *REPOS_PATH* ]]; then
           args+=( ":path:_files -/" )


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