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

Re: bash_completion - subversion add: svn ls/merge ^/<remote path>

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 19 Aug 2015 17:31:15 +0100

Christian Ferbar wrote:
> this patch works for svn ls and svn merge now.

Thanks, Chris. This looks lovely! I'll try it out later.

> I'm not sure if it makes sense for other commands, however it is a separate function an can be used easily for other commands as well.

I'm sure it makes sense to enable URL completion for lots of other
commands -- e.g., "svn copy URL1 URL2" is often used for branching and
tagging.

> _svn_lls() looks broken for me because ${dn}.svn/text-base/${fn}.svn-base doesn't exist any more

Good observation. I'll see if I can fix or delete that part.

> I suggest to enable SVN_BASH_COMPL_EXT=urls by default since nobody reads a documentation and enables it.

Yes, good point.

- Julian

>> Thanks, Chris. This looks much better already. (I haven't tried it.)
>>
>> > I need some feedback concerning:
>> >
>> > -> how to deal with svn error messages written to stderr, for example:
>> > svn ls svn+ssh://svn.something.com/<tab><tab>user_at_svn.something.com's password:
>> >
>> > this happens when you forget to do ssh-add
>>
>> I suggest it should simply not provide any completions that cannot be
>> obtained without further input. Use --non-interactive so that
>> Subversion does not prompt for passwords. Prevent any stderr output
>> being printed to the console (maybe use "2> /dev/null"). Then make
>> sure the script behaves OK (just returning no completions) when
>> Subversion returns an error. You might need to look for a non-zero
>> exit code explicitly, but maybe not: it might be enough to just try
>> parsing the stdout and if there is no recognizable stdout then you get
>> no resulting completions.
>>
>> > -> in bash >= 4 they changed COMP_WORDS. The Line will be split at : as well, so "file:/something" are 3 array items. Nobody would use subversion 1.9 with bash 3 ... probably. I will drop bash 3 statements, for example:
>> >
>> > if [[ $cur == file:* ]]
>> >
>> > ok?
>>
>> Dropping support for Bash 3 sounds OK to me, if it is difficult to
>> keep it working. Especially good if only the URL completion depends on
>> Bash 4 and all the rest of the existing kinds of completion keep
>> working with Bash 3.
>>
>> >> Please can URL completion work on full URLs as well as on relative URLs?
>> > for SVN LS this is done:
>> >
>> > 1. svn ls tabtab -> ^/ file:/// http:// https:// svn:// svn+ssh://
>> > 2. svn ls svn+ssh://tabtab -> will look at the ~/.ssh/known_hosts
>> > 3. svn ls http[s]://tabtab -> lookup in ~/.subversion/simple-auth - should still be working
>> > 4. svn ls proto://server/tabtab or ^/tabtab -> autocomplete via "svn ls"
>>
>> Excellent, that looks like the sort of thing I was hoping for.
>>
>> - Julian
Received on 2015-08-19 18:31:55 CEST

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.