Reputation: 54457
Subversion keeps its proxy configuration in the ~/.subversion/servers
file (https://www.visualsvn.com/support/svnbook/advanced/confarea/#svn.advanced.confarea.opts.servers).
Is there a way to access this information through the Subversion command line client, similar to something like git config --global --list
?
I'm looking for a way to access this information for both read and write access, and I would like to avoid parsing the file.
Upvotes: 2
Views: 163
Reputation: 54457
Since it doesn't seem to be possible to get the proxy configuration through the svn executable, I resorted to using an embedded Python script. Why Python? Since it has the ConfigParser module, which allows to read/write INI-style files:
if $(command -v svn &> /dev/null) && $(command -v python &> /dev/null) ; then
python - <<END
import ConfigParser, os
config = ConfigParser.ConfigParser()
config.read(os.path.expanduser('~/.subversion/servers'))
if (config.has_section('global')):
proxy_host = ''
proxy_port = ''
proxy_exceptions = ''
if (config.has_option('global', 'http-proxy-host')):
proxy_host = config.get('global', 'http-proxy-host')
if (config.has_option('global', 'http-proxy-port')):
proxy_port = config.get('global', 'http-proxy-port')
if (config.has_option('global', 'http-proxy-exceptions')):
proxy_exceptions = config.get('global', 'http-proxy-exceptions')
print 'http-proxy-host : ' + proxy_host
print 'http-proxy-port : ' + proxy_port
print 'http-proxy-exceptions: ' + proxy_exceptions
END
fi
This code reads the ~/.subversion/servers
file and prints the values. Similar code can be used to change the proxy values.
Upvotes: 1