Skip to content

Commit

Permalink
49715: _subversion: add: Complete target arguments to this subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
danielshahaf committed Jan 29, 2022
1 parent a956caa commit 04513dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2022-01-29 Daniel Shahaf <d.s@daniel.shahaf.name>

* 49715: Completion/Unix/Command/_subversion: add: Complete
target arguments to this subcommand

* 49714: Completion/Unix/Command/_subversion: resolve: Complete
conflicted files created by merges, too

Expand Down
24 changes: 14 additions & 10 deletions Completion/Unix/Command/_subversion
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ _svn () {
case $cmd in;
(add)
args+=(
'*:file:_files -g "*(e:_svn_uncontrolled:)"'
'*:file: _svn_modified "addable"'
)
;;
(auth)
Expand Down Expand Up @@ -350,18 +350,12 @@ _svn_controlled() {
# 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.
# TODO: Reimplement this function 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() {
# ### These strings are actually translatable
Expand All @@ -375,7 +369,7 @@ _svn_conflicts() {
_svn_modified() {
setopt localoptions extendedglob

local depth dir expl partial_word space=' '
local depth dir expl maybe_quiet partial_word space=' '

local svn_context=$1

Expand All @@ -394,9 +388,15 @@ _svn_modified() {
depth=immediates
fi

if [[ $svn_context = addable ]]; then
maybe_quiet=""
else
maybe_quiet="-q"
fi

local -a status_lines
# Run 'status'
status_lines=( ${(f)"$(_call_program modified-files "svn status -q --depth=${(q)depth} -- ${(q)dir}")"} )
status_lines=( ${(f)"$(_call_program modified-files "svn status $maybe_quiet --depth=${(q)depth} -- ${(q)dir}")"} )
# Filter to only the right set of statuses
case $svn_context in
(committable)
Expand All @@ -405,6 +405,10 @@ _svn_modified() {
(revertable)
status_lines=( ${(M)status_lines:#(#s)([ACDMR~!]?|?[CM])${space}????${space}*} )
;;
(addable)
# The 'D' is just in case there's an unversioned file of the same name as the deleted file
status_lines=( ${(M)status_lines:#(#s)[?ID]${space}${space}???${space}${space}*} )
;;
esac
# Strip the 7 status-letter columns and the column of spaces
status_lines=( ${status_lines#????????} )
Expand Down

0 comments on commit 04513dd

Please sign in to comment.