Thursday, May 05, 2005

Tinkering: Bash and Subversion 2

It turns out that just doing -W with the names of the options to svn ends up disabling the normal file name completion. This is rather painful when you want to do things like type 'svn add ' and hit tab to get a list of files you might want to add to the repository. To fix this, you have to specify the -f option after the -W option, like this:

complete -W 'add blame praise annotate cat checkout co cleanup commit ci
copy delete del remove rm diff di export help h import info list ls log merge
mkdir move mv rename ren propdel pdel pd propedit pedit pe propget pget
pg proplist plist pl propset pset ps resolved revert status stat st switch sw
update up' -f svn

This turns file/directory completion back on, which is good, but leaves all the svn commands (like help, diff, etc.) still in the list of completions even after you've provided a command to svn, which is bad. If anyone knows how to make bash only list file/directory completions when I've already specified the command for svn to use, I'd love to know.

One other handy thing in bash is the FIGNORE environment variable. This variable is a colon-separated list of names to ignore. So, setting it to ignore the .svn directory is as simple as:

export FIGNORE='.svn'

Of course, if you already have things in FIGNORE (e.g. the .ssh directory, the CVS directory, etc.), you will need to append .svn to the list.

I'm really looking forward to full integration of Subversion with IDEA, but even after that comes about, some things are just easier on the command line and this makes them even easier.

No comments: