summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_subversion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_subversion')
-rw-r--r--Completion/Unix/Command/_subversion70
1 files changed, 60 insertions, 10 deletions
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index a066b0728..a1e9109de 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -11,11 +11,15 @@ _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'"
+ changelist "the changelist this file was added to, if any"
)
local update_policy
@@ -30,11 +34,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
+ [[ $(_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 +77,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 `"'))' )
@@ -106,7 +123,19 @@ _svn () {
case $cmd in;
(add)
args+=(
- '*:file:_files -g "*(^e:_svn_controlled:)"'
+ '*:file:_files -g "*(e:_svn_uncontrolled:)"'
+ )
+ ;;
+ (auth)
+ args+=(
+ '*:auth pattern: '
+ )
+ ;;
+ (changelist)
+ args[(r)--remove]='(1)--remove'
+ args+=(
+ '(--remove)1:changelist name:_svn_changelists'
+ '*:file:_files -g "*(e:_svn_controlled:)"'
)
;;
(commit)
@@ -145,6 +174,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'
@@ -159,7 +194,7 @@ _svn () {
'*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"'
)
;;
- (resolved)
+ (resolve|resolved)
args+=(
'*:file:_files -g "*(e:_svn_conflicts:)"'
)
@@ -169,9 +204,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)*)
@@ -310,12 +345,27 @@ _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] )) ||
_svn_conflicts() {
- [ -n $REPLY.(mine|r<->)(N[1]) ]
+ () { (( $# > 0 )) } $REPLY.(mine|r<->)(NY1)
}
(( $+functions[_svn_deletedfiles] )) ||