zsh-workers
 help / color / mirror / code / Atom feed
* _subversion is going to need to use 'help -v'
@ 2019-08-31 20:19 Daniel Shahaf
  2019-09-04  2:54 ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2019-08-31 20:19 UTC (permalink / raw)
  To: zsh-workers; +Cc: Cristiano De Michele

tl;dr: A change made to Subversion (upstream) trunk today affects _subversion.

_subversion completes subcommands based on the output of `svn help`.

Subversion upstream have just made a change whereby subcommands named
x-* will not be shown in `svn help`, but only in `svn help -v`.  The change will
presumably be released in 1.13.0 in October (unless something comes up in
post-commit reviews upstream).

I assume we should, at least, teach _subversion to pass -v if the 'svn'
binary is new enough.  That would let x-* subcommands continue to be
offered. We could try either «svn help -v || svn help» or «if [[ `svn
--version -q` == (2.*|1.<13->.*) ]]; then …; else …; fi».

Upstream is also discussing hiding some options by default, but that
hasn't been implemented yet.

Any volunteers to look into this?

Cheers,

Daniel

P.S. Speaking of experimental svn features, is anyone using both
shelving and vcs_info?

julianfoad@apache.org wrote on Sat, 31 Aug 2019 06:49 +00:00:
> Author: julianfoad
> Date: Sat Aug 31 06:49:24 2019
> New Revision: 1866188
> 
> URL: http://svn.apache.org/viewvc?rev=1866188&view=rev
> Log:
> Issue #4828, Hide experimental commands and options by default.
> 
> * subversion/libsvn_subr/opt.c
>   (print_command_info3,
>    print_generic_help_body3): Show commands and options starting with
>     'x-' only if new 'with_experimental' option is true.
^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _subversion is going to need to use 'help -v'
  2019-08-31 20:19 _subversion is going to need to use 'help -v' Daniel Shahaf
@ 2019-09-04  2:54 ` Daniel Shahaf
  2019-10-10 16:29   ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2019-09-04  2:54 UTC (permalink / raw)
  To: zsh-workers; +Cc: Cristiano De Michele

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

Daniel Shahaf wrote on Sat, 31 Aug 2019 20:19 +00:00:
> tl;dr: A change made to Subversion (upstream) trunk today affects _subversion.

Patch attached.  I think it's fairly safe to commit it already, even
before the upstream release: it's unlikely that «svn help -v» will be
made to mean "grow a toaster's arm".

Cheers,

Daniel

[-- Attachment #2: 0001-_subversion-Use-svn-help-v-to-show-global-option.patch.txt --]
[-- Type: text/plain, Size: 3224 bytes --]

From 474b54a1c97e4f7b81368e7b10b3b5b1fe359dd0 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@daniel.shahaf.name>
Date: Sun, 1 Sep 2019 00:35:42 +0000
Subject: [PATCH 1/2] _subversion: Use 'svn help -v' to show global options,
 experimental options, and experimental subcommands (upstream issue SVN-4828,
 to be released in Subversion 1.13.0)

---
 Completion/Unix/Command/_subversion | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index a066b0728..6d9178a2f 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -30,11 +30,24 @@ _svn () {
     '1: :->cmds' \
     '*:: :->args' && ret=0
 
+  local _svn_help_takes_verbose
+  if _cache_invalid svn-help-takes-verbose || ! _retrieve_cache svn-help-takes-verbose; then
+    if [[ $(_call_program svn-help-v svn help help) == *--verbose* ]]
+    _svn_help_takes_verbose=$(( ! $? ))
+    _store_cache svn-help-takes-verbose _svn_help_takes_verbose
+  fi
+  if (( _svn_help_takes_verbose )); then
+    readonly dash_v="-v"
+  else
+    readonly dash_v
+  fi
+  unset _svn_help_takes_verbose
+
   if [[ -n $state ]] && (( ! $+_svn_cmds )); then
     typeset -gHA _svn_cmds
     if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then
       _svn_cmds=(
-	${=${(f)${${"$(_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]//[(),]}// /:}}:}
+	${=${(f)${${"$(_call_program commands svn help $dash_v)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?-]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
       )
       if (( $? == 0 )); then
         _store_cache svn-cmds _svn_cmds
@@ -60,14 +73,14 @@ _svn () {
 	if _cache_invalid svn-${cmd}-usage || \
 	    ! _retrieve_cache svn-${cmd}-usage;
 	then
-	  usage=${${(M)${(f)"$(_call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
+	  usage=${${(M)${(f)"$(_call_program options svn help $dash_v -- $cmd)"}:#usage:*}#usage:*$cmd] }
 	  _store_cache svn-${cmd}-usage usage
 	fi
 	if _cache_invalid svn-${cmd}-usage || \
 	    ! _retrieve_cache svn-${cmd}-args;
 	then
 	  args=(
-	    ${=${${${(M)${(f)"$(_call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]}
+	    ${=${${${(M)${(f)"$(_call_program options svn help $dash_v -- $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]}
 	  )
           while (( idx=$args[(I)*--accept:arg:] )); do
             args[idx]=( --accept'=:automatic conflict resolution action:((working\:working base\:base recommended\:recommended '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' )

[-- Attachment #3: 0002-_subversion-Update-show-item-completion-to-1.12..patch.txt --]
[-- Type: text/plain, Size: 1306 bytes --]

From 44b79f5937630c2d387f489356c90db174e4449e Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@daniel.shahaf.name>
Date: Wed, 4 Sep 2019 02:47:19 +0000
Subject: [PATCH 2/2] _subversion: Update --show-item= completion to 1.12.0.

---
 Completion/Unix/Command/_subversion | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 6d9178a2f..2c8085045 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -11,11 +11,14 @@ _svn () {
      relative-url          "the repository-relative URL"
      repos-root-url        "the repository root URL"
      repos-uuid            "the repository UUID"
+     repos-size            "the size of TARGET in the repository (for files only)"
      revision              "the revision of TARGET"
      last-changed-revision "the most recent revision in which TARGET was changed"
      last-changed-date     "the date of the last-changed revision"
      last-changed-author   "the author of the last-changed revision"
      wc-root               "the working copy root path"
+     schedule              "'normal', 'add', 'delete', 'replace'"
+     depth                 "'infinity', 'immediates', 'files', 'empty', 'exclude'"
   )
 
   local update_policy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _subversion is going to need to use 'help -v'
  2019-09-04  2:54 ` Daniel Shahaf
@ 2019-10-10 16:29   ` Mikael Magnusson
  2019-10-10 16:58     ` [PATCH] _subversion: Fix syntax error in 44726/0001 Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2019-10-10 16:29 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-workers, Cristiano De Michele

On 9/4/19, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Daniel Shahaf wrote on Sat, 31 Aug 2019 20:19 +00:00:
>> tl;dr: A change made to Subversion (upstream) trunk today affects
>> _subversion.
>
> Patch attached.  I think it's fairly safe to commit it already, even
> before the upstream release: it's unlikely that «svn help -v» will be
> made to mean "grow a toaster's arm".

The "Use 'svn help -v' to show global options" patch is broken:
re-compiling /usr/local/share/zsh/5.7.1-dev-0-mika/functions.zwc:
zrecompile:41: parse error near `fi'
the resulting code is:
  if _cache_invalid svn-help-takes-verbose || ! _retrieve_cache
svn-help-takes-verbose; then
    if [[ $(_call_program svn-help-v svn help help) == *--verbose* ]]
    _svn_help_takes_verbose=$(( ! $? ))
    _store_cache svn-help-takes-verbose _svn_help_takes_verbose
  fi

which has both unclear indentation and intention. I would fix it but I
don't know if you meant to include both lines in the if. Please don't
use short_loops malformed syntax in distributed code because it always
leads to incorrectly written code like the above.

-- 
Mikael Magnusson

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] _subversion: Fix syntax error in 44726/0001
  2019-10-10 16:29   ` Mikael Magnusson
@ 2019-10-10 16:58     ` Daniel Shahaf
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2019-10-10 16:58 UTC (permalink / raw)
  To: zsh-workers

---
Mikael, thanks for the report.  I didn't intend to use shortloops syntax there.

 Completion/Unix/Command/_subversion | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 2c8085045..120f17642 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -35,7 +35,7 @@ _svn () {
 
   local _svn_help_takes_verbose
   if _cache_invalid svn-help-takes-verbose || ! _retrieve_cache svn-help-takes-verbose; then
-    if [[ $(_call_program svn-help-v svn help help) == *--verbose* ]]
+    [[ $(_call_program svn-help-v svn help help) == *--verbose* ]]
     _svn_help_takes_verbose=$(( ! $? ))
     _store_cache svn-help-takes-verbose _svn_help_takes_verbose
   fi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-10 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31 20:19 _subversion is going to need to use 'help -v' Daniel Shahaf
2019-09-04  2:54 ` Daniel Shahaf
2019-10-10 16:29   ` Mikael Magnusson
2019-10-10 16:58     ` [PATCH] _subversion: Fix syntax error in 44726/0001 Daniel Shahaf

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).