From 770dca2c536cc7cf3921785f28d486a2b3926a56 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 1 Sep 2019 00:35:42 +0000 Subject: 44726/0001: _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(-) (limited to 'Completion/Unix/Command/_subversion') 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 `"'))' ) -- cgit v1.2.3 From 2829e32e3cc894bdd4fffced1cfd78a72dbff763 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 4 Sep 2019 02:47:19 +0000 Subject: 44726/0002: _subversion: Update --show-item= completion to 1.12.0. --- ChangeLog | 3 +++ Completion/Unix/Command/_subversion | 3 +++ 2 files changed, 6 insertions(+) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 54a6f0e78..234120191 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2019-09-04 Daniel Shahaf + * 44726/0002: Completion/Unix/Command/_subversion: Update + --show-item= completion to 1.12.0. + * 44726/0001: Completion/Unix/Command/_subversion: Use 'svn help -v' to show global options, experimental options, and experimental subcommands (upstream issue SVN-4828, to be 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 -- cgit v1.2.3 From 1156b2aa4444e4c9f66488cc134887faf2c01f74 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 10 Oct 2019 16:58:21 +0000 Subject: 44812: _subversion: Fix syntax error in 44726/0001 --- ChangeLog | 3 +++ Completion/Unix/Command/_subversion | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 668ef3bfc..c7695c09d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2019-10-14 Daniel Shahaf + * 44812: Completion/Unix/Command/_subversion: Fix syntax error + in 44726/0001 + * 44809: Completion/Zsh/Command/_typeset: Complete 'functions -c' 2019-10-12 dana 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 -- cgit v1.2.3 From ed26bf92d62c5679c49a842fa85c72ef8317635f Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 7 Nov 2019 11:26:43 +0000 Subject: 44897: _subversion: Complete --show-item=changelist --- ChangeLog | 5 +++++ Completion/Unix/Command/_subversion | 1 + 2 files changed, 6 insertions(+) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 27c0f208c..e7de9a4a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-11-07 Daniel Shahaf + + * 44897: Completion/Unix/Command/_subversion: Complete + --show-item=changelist + 2019-11-06 Oliver Kiddle * 44895: Completion/Solaris/Command/_svccfg: complete options diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 120f17642..28223c55b 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -19,6 +19,7 @@ _svn () { wc-root "the working copy root path" schedule "'normal', 'add', 'delete', 'replace'" depth "'infinity', 'immediates', 'files', 'empty', 'exclude'" + changelist "the changelist this file was added to, if any" ) local update_policy -- cgit v1.2.3 From b06117ad21ce8be928e64700f34f7610d45c738a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 7 Nov 2019 17:48:11 +0000 Subject: 44904: _subversion: Complete multiple comma-separated arguments to --show-item=. Upstream revision: r1869578 (for 1.14.0) --- ChangeLog | 5 +++++ Completion/Unix/Command/_subversion | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index f8998cc20..64b230cb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-11-09 Daniel Shahaf + + * 44904: Completion/Unix/Command/_subversion: Complete multiple + comma-separated arguments to --show-item=. + 2019-11-08 Daniel Shahaf * unposted: Doc/Zsh/compsys.yo: _values: Use the formal diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 28223c55b..b5532b101 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -3,8 +3,9 @@ _svn () { local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args + local i - # Colons in values must be escaped. + # Colons and closing square brackets in values must be escaped. local -A show_item_keys=( kind "the kind of TARGET (file or dir)" url "the URL of TARGET in the repository" @@ -112,7 +113,11 @@ _svn () { done while (( idx=$args[(I)*--show-item:arg:] )); do # (q) to quote the parentheses in the value - args[idx]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' ) + local -a show_items_plain_array + for i in ${(k)show_item_keys}; do + show_items_plain_array+=( $i\[${show_item_keys[$i]}\] ) + done + args[idx]=( --show-item'=:item key:_values -s , "info items" ${show_items_plain_array[@]}' ) done # All other options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) -- cgit v1.2.3 From a6b6b650fbd4e5c024c86cd3964e518ff2dafa3e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Nov 2019 01:45:17 +0000 Subject: 44946: _subversion: Make _svn_conflicts not offer all files in the directory. --- ChangeLog | 5 +++++ Completion/Unix/Command/_subversion | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 97a2ef86d..09ac0641f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-11-29 Daniel Shahaf + + * 44946: Completion/Unix/Command/_subversion: Make _svn_conflicts + not offer all files in the directory. + 2019-11-26 Wayne Davison * 44912: Completion/Base/Completer/_expand: Don't set done_quote=1 diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index b5532b101..04a8da0bf 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -337,7 +337,7 @@ _svn_controlled() { (( $+functions[_svn_conflicts] )) || _svn_conflicts() { - [ -n $REPLY.(mine|r<->)(N[1]) ] + () { (( $# > 0 )) } $REPLY.(mine|r<->)(NY1) } (( $+functions[_svn_deletedfiles] )) || -- cgit v1.2.3 From a4f5c345c89a066672328c81316ad9cad7a4c7cb Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Nov 2019 01:45:18 +0000 Subject: 44947: _subversion: Complete the 'auth', 'changelist', 'patch', 'resolve', and 'x-unshelve' subcommands. --- ChangeLog | 4 ++++ Completion/Unix/Command/_subversion | 26 ++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 09ac0641f..e870beee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2019-11-29 Daniel Shahaf + * 44947: Completion/Unix/Command/_subversion: Complete the + 'auth', 'changelist', 'patch', 'resolve', and 'x-unshelve' + subcommands. + * 44946: Completion/Unix/Command/_subversion: Make _svn_conflicts not offer all files in the directory. diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 04a8da0bf..b39c8578e 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -131,6 +131,18 @@ _svn () { '*:file:_files -g "*(^e:_svn_controlled:)"' ) ;; + (auth) + args+=( + '*:auth pattern: ' + ) + ;; + (changelist) + args[(r)--remove]='(1)--remove' + args+=( + '(--remove)1:changelist name:_svn_changelists' + '*:file:_files -g "*(e:_svn_controlled:)"' + ) + ;; (commit) args=( ${args/(#b)(*--file*):arg:/$match[1]:file:_files} @@ -167,6 +179,12 @@ _svn () { (mergeinfo) args[(r)--show-revs=:arg:]=( '--show-revs=:revisions:(merged eligible)' ) ;; + (patch) + args+=( + '1:patch file:_files' + '2::working copy to patch:_files' + ) + ;; (propget|propedit|propdel) args+=( '1:property name:_svn_props' @@ -181,7 +199,7 @@ _svn () { '*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) ;; - (resolved) + (resolve|resolved) args+=( '*:file:_files -g "*(e:_svn_conflicts:)"' ) @@ -191,9 +209,9 @@ _svn () { '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"' ) ;; - (unshelve) - args+=( '1:shelf name:compadd - ${${(f)"$(_call_program shelves svn unshelve -q --list)"}%% *}' ) - ;; + (x-unshelve) + args+=( '1:shelf name:compadd - ${(f)"$(_call_program shelves svn x-shelves --quiet)"}' '2::shelf version' ) + ;; (*) case $usage in *(SRC|DST|TARGET|URL*PATH)*) -- cgit v1.2.3 From dae3e135d8c3e2d16e7dc22582aa8a3f66716de7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Nov 2019 01:45:19 +0000 Subject: 44948: _subversion: Make _svn_controlled offer everything rather than nothing. --- ChangeLog | 3 +++ Completion/Unix/Command/_subversion | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index e870beee8..b6ee5ca22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2019-11-29 Daniel Shahaf + * 44948: Completion/Unix/Command/_subversion: Make + _svn_controlled offer everything rather than nothing. + * 44947: Completion/Unix/Command/_subversion: Complete the 'auth', 'changelist', 'patch', 'resolve', and 'x-unshelve' subcommands. diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index b39c8578e..2ce43a0cd 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -128,7 +128,7 @@ _svn () { case $cmd in; (add) args+=( - '*:file:_files -g "*(^e:_svn_controlled:)"' + '*:file:_files -g "*(e:_svn_uncontrolled:)"' ) ;; (auth) @@ -350,7 +350,22 @@ _svnadmin () { (( $+functions[_svn_controlled] )) || _svn_controlled() { - [[ -f ${(M)REPLY##*/}.svn/text-base/${REPLY##*/}.svn-base ]] + # For svn<=1.6, this was implemented as: + # [[ -f ${(M)REPLY##*/}.svn/text-base/${REPLY##*/}.svn-base ]] + # However, because that implementation returns false for all files on svn>=1.7, and + # because 1.6 has been deprecated for 8 years and EOL for 6 years, we opt to DTRT + # for >=1.7. Therefore: + + # TODO: Reimplement this function and _svn_uncontrolled for svn>=1.7. + # (Use 'svn st' or 'svn info', not 'svn ls') + return 0 +} + + +(( $+functions[_svn_uncontrolled] )) || +_svn_uncontrolled() { + # TODO: See comments in _svn_controlled + return 0 } (( $+functions[_svn_conflicts] )) || -- cgit v1.2.3 From 06dddd0b98da9fa285573b1a6e1a0ecc2d6c6bd4 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 3 Dec 2019 12:27:13 +0000 Subject: Revert "44904: _subversion: Complete multiple comma-separated arguments to --show-item=." This reverts commit b06117ad21ce8be928e64700f34f7610d45c738a. Reverted upstream in r1870750. --- ChangeLog | 5 ----- Completion/Unix/Command/_subversion | 9 ++------- 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index a2b2f3073..6245c976a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -96,11 +96,6 @@ * unposted (salsa.debian.org MR!1): Completion/Unix/Command/_ip: Complete the -brief option -2019-11-09 Daniel Shahaf - - * 44904: Completion/Unix/Command/_subversion: Complete multiple - comma-separated arguments to --show-item=. - 2019-11-08 Daniel Shahaf * unposted: Doc/Zsh/compsys.yo: _values: Use the formal diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 2ce43a0cd..a1e9109de 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -3,9 +3,8 @@ _svn () { local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args - local i - # Colons and closing square brackets in values must be escaped. + # Colons in values must be escaped. local -A show_item_keys=( kind "the kind of TARGET (file or dir)" url "the URL of TARGET in the repository" @@ -113,11 +112,7 @@ _svn () { done while (( idx=$args[(I)*--show-item:arg:] )); do # (q) to quote the parentheses in the value - local -a show_items_plain_array - for i in ${(k)show_item_keys}; do - show_items_plain_array+=( $i\[${show_item_keys[$i]}\] ) - done - args[idx]=( --show-item'=:item key:_values -s , "info items" ${show_items_plain_array[@]}' ) + args[idx]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' ) done # All other options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) -- cgit v1.2.3