Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 5/5] _subversion: add: Complete target arguments to this subcommand



---
 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#????????} )




Messages sorted by: Reverse Date, Date, Thread, Author