On 25 May, Joerg Sommer wrote:
> 
> can you add completion support for svn diff? If I understand it right, it
> should be the same rule like commit -- all files they are known by svn
> are able to be used with diff.

The patch below should fix this and bug 342348. The diff subcommand can
also take URLs so it isn't quite the same as for commit. I've made the
URL completion a bit cleverer using svn list too.

Clint: I'd appreciate if you can get this into upstream CVS as I'm
currently without access to a net connection that doesn't block ssh.

Oliver

--- _subversion.orig    Thu Jun  1 10:53:09 2006
+++ _subversion Thu Jun  1 18:03:19 2006
@@ -49,6 +49,11 @@
               '*:file:_files -g ".svn(/e:_svn_deletedfiles:)"'
             )
           ;;
+          diff)
+            args+=(
+             '*: : _alternative "files:file:_files -g \*\(e:_svn_status:\)" 
"urls:URL:_svn_urls"'
+           )
+          ;;
           help)
             args+=(
               '*::sub command:_svn_commands'
@@ -60,6 +65,11 @@
              '*:file:_files -g "*(e:_svn_controlled:)"'
             )
           ;;
+          resolved)
+            args+=(
+              '*:file:_files -g "*(e:_svn_conflicts:)"'
+            )
+          ;;
           revert)
             args+=(
               '*:file:_files -g 
"(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"'
@@ -141,6 +151,11 @@
   [[ -f ${(M)REPLY##*/}.svn/text-base/${REPLY##*/}.svn-base ]]
 }
 
+(( $+functions[_svn_conflicts] )) ||
+_svn_conflicts() {
+  [ -n $REPLY.(mine|r<->)(N[1]) ]
+}
+
 (( $+functions[_svn_deletedfiles] )) ||
 _svn_deletedfiles() {
   # Typical usage would be _files -g '.svn(/e:_svn_deletedfiles:)'
@@ -167,15 +182,32 @@
 
 (( $+functions[_svn_urls] )) ||
 _svn_urls() {
-  local expl
+  local expl remfiles remdispf remdispd suf ret=1
 
-  if [[ -prefix *: ]]; then
-    _urls
+  if [[ -prefix *: ]] && ! _urls &&
+      zstyle -T ":completion:${curcontext}:" remote-access
+  then
+    remfiles=( ${(f)"$(svn list $IPRFIX${PREFIX%%[^./][^/]#} 2>/dev/null)"} )
+    compset -P '*/'
+    compset -S '/*' || suf=file
+    remdispf=(${remfiles:#*/})
+    remdispd=(${(M)remfiles:#*/})
+    _tags files
+    while _tags; do
+      while _next_label files expl ${suf:-directory}; do
+        [[ -n $suf ]] && compadd "$@" "[EMAIL PROTECTED]" -d remdispf 
$remdispf && ret=0
+        compadd ${suf:+-S/} "$@" "[EMAIL PROTECTED]" -d remdispd \
+            ${remdispd%/} && ret=0
+      done
+      (( ret )) || return 0
+    done
   else
     compset -S '[^:]*'
     _wanted url-schemas expl 'URL schema' compadd -S '' - \
-        file:// http:// https:// svn:// svn+ssh://
+        file:// http:// https:// svn:// svn+ssh:// && ret=0
   fi
+  
+  return ret
 }
 
 (( $+functions[_svn_commands] )) ||


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to