--- bash_completion 2004-12-11 11:55:27.000000000 -0400 +++ bash_completion_svn 2004-12-11 12:02:42.000000000 -0400 @@ -39,9 +39,13 @@ # if not typing an option, or if the previous option required a # parameter, then fallback on ordinary filename expansion helpCmds='help|--help|h|\?' + urlCmds='co|checkout|ls|list|cp|copy|mv|move' if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \ [[ "$cur" != -* ]] || \ [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]] ; then + if [[ ${COMP_WORDS[1]} == @($urlCmds) ]] ; then + _svn_url + fi return 0 fi @@ -208,7 +212,44 @@ return 0 } -complete -F _svn -o default svn +complete -F _svn -o default -o nospace svn + +_svn_url () +{ + local cur protocols path repopath tmp + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + + if [[ ${cur} == *:* ]] ; then + path=${cur#file://} + tmp=${path%svnrepo*} + + if [ "$path" != "" ] && [ "$path" != "$tmp" ]; then + path=${tmp}svnrepo + fi + + if [ -r "${path}/db" ]; then + repopath=${cur#*svnrepo} + + if [[ ${repopath} == */* ]] ; then + validpath=${repopath%\/*} + else + validpath="" + fi + + files=$( svn ls file://$path$validpath ) + COMPREPLY=( $( compgen -P "//$path$validpath/" -W "$files" ${repopath##*/} ) ) + else + COMPREPLY=( $( compgen -P "//" -S "/" -d $path ) ) + fi + else + protocols="svn file http ssh+svn" + COMPREPLY=( $( compgen -S "://" -W "$protocols" $cur ) ) + fi + + return 0 +} _svnadmin () {