[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] bash_completion: propose file names for few commands

From: Krzysiek Pawlik <nelchael_at_gentoo.org>
Date: 2007-06-03 14:33:30 CEST

Fabien COELHO wrote:
> ISTM that it is not only the recursion but the whole svn calls which
> should be disabled. That would/could make two options... Moreover, I
> would prefer the option to be "disabled" by default.

It's disabled by default now.

> I noticed that you also put sed, so we have a sed+grep+cut dependency,
> possibly the 3 of them together, that makes 4 fork/exec on a <tab>.
> Possibly one would be enough, e.g. sed can do it all. Or a shell loop.

I've removed the sed.

> Also about "if [[ ... ]] && [[ ... ]]", one can have "&&" directly
> within the [[ ... ]] test in bash.

I know, it's just a matter of style.

> About revert: more things can be reverted, including a D or an A, not
> just M or !. If you replace the file completion list, you must get it
> right.

Fixed

> About log: basically one can ask about the log of any file, added value
> of having a "svn ls" is quite reduced here?

If the file is not known to subversion it just prints an error, so IMHO there is
a point in limiting log to only known files.

> About del: I cannot see the point of the 'sed -e 1d'. If it is to skip
> the current directory, it is just wrong as externals are displayed
> before it.

Fixed, thanks.

> I'm unsure also about what happends under different locales (e.g.
> Chinese or the like) when handling the output of "svn something". Might
> be just okay, but I don't know.

Works with pl_PL and pl_PL.UTF-8

-- 
Krzysiek Pawlik   <nelchael at gentoo.org>   key id: 0xBC555551
desktop-misc, desktop-dock, x86, java, apache, ppc...

--- /usr/share/bash-completion/subversion 2007-05-16 11:00:15.000000000 +0200
+++ bin/bash_completion.d/subversion 2007-06-03 14:29:45.000000000 +0200
@@ -1,3 +1,4 @@
+# vim: tw=80
 # Programmable completion for the Subversion svn command under bash. Source
 # this file (or on some systems add it to ~/.bash_completion and start a new
 # shell) and bash's completion mechanism will know all about svn's options!
@@ -420,7 +421,32 @@
 
         # if not typing an option,
         # then fallback on ordinary filename expansion
- if [[ $cur != -* || $stat = 'onlyarg' ]] ; then
+ if [[ -n "${SVN_EXT_COMPLETION}" ]] && [[ $cur != -* || $stat = 'onlyarg' ]]
+ then
+ local nr='-N'
+ [[ -n "${SVN_EXT_RECURSIVE}" ]] && nr=''
+ case $cmd in
+ revert)
+ local FILESrevert="$(svn status --non-interactive ${nr} \
+ | grep '^[MAD!]' | cut -b 8-)"
+ COMPREPLY=( $( compgen -W "$FILESrevert" -- $cur ) )
+ ;;
+ add)
+ local FILESadd="$(svn status --non-interactive ${nr} \
+ | grep '^?' | cut -b 8-)"
+ COMPREPLY=( $( compgen -W "$FILESadd" -- $cur ) )
+ ;;
+ log)
+ local FILESlog="$(svn status --non-interactive -v -N \
+ | cut -b 41-)"
+ COMPREPLY=( $( compgen -W "$FILESlog" -- $cur ) )
+ ;;
+ remove|rm|delete|del)
+ local FILESremove="$(svn status --non-interactive -v -N \
+ | cut -b 41- | grep -v '^\.$')"
+ COMPREPLY=( $( compgen -W "$FILESremove" -- $cur ) )
+ ;;
+ esac
             return 0
         fi
 

Received on Sun Jun 3 14:32:31 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.