From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 5/5] _subversion: add: Complete target arguments to this subcommand
Date: Wed, 26 Jan 2022 14:18:47 +0000 [thread overview]
Message-ID: <20220126141847.10271-5-danielsh@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20220126141847.10271-1-danielsh@tarpaulin.shahaf.local2>
---
Completion/Unix/Command/_subversion | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index e9a3d9b1a..8fc46a292 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -122,7 +122,7 @@ _svn () {
case $cmd in;
(add)
args+=(
- '*:file:_files -g "*(e:_svn_uncontrolled:)"'
+ '*:file: _svn_modified "addable"'
)
;;
(auth)
@@ -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
@@ -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
@@ -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)
@@ -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#????????} )
prev parent reply other threads:[~2022-01-26 14:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 14:18 [PATCH 1/5] _subversion: _svn_status: Don't offer unversioned files Daniel Shahaf
2022-01-26 14:18 ` [PATCH 2/5] _subversion: svn rm: Complete all svn-controlled files, not only missing/deleted files Daniel Shahaf
2022-01-26 14:18 ` [PATCH 3/5] _subversion: commit, diff, revert: Update completions for svn 1.7 and newer Daniel Shahaf
2022-01-26 14:18 ` [PATCH 4/5] _subversion: resolve: Complete conflicted files created by merges, too Daniel Shahaf
2022-01-26 14:18 ` Daniel Shahaf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220126141847.10271-5-danielsh@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).