Skip to content

Commit 75120dd

Browse files
vladakVladimir Kotal
authored andcommitted
proxy support for Subversion
1 parent 39512d1 commit 75120dd

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

tools/sync/svn.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,33 @@ def __init__(self, logger, path, project, command, env, hooks):
4141
raise OSError
4242

4343
def reposync(self):
44-
hg_command = [self.command, "update"]
45-
cmd = Command(hg_command, work_dir=self.path, env_vars=self.env)
44+
svn_command = [self.command]
45+
46+
#
47+
# The proxy configuration in SVN does not heed environment variables so
48+
# they need to be converted to the options.
49+
#
50+
http_proxy = self.env.get('http_proxy')
51+
if http_proxy:
52+
data = http_proxy.split(':')
53+
if len(data) != 2:
54+
logger.error("Cannot split '{}' into two strings by ':'".
55+
format(http_proxy))
56+
return 1
57+
58+
svn_command.append("--config-option")
59+
svn_command.append("servers:global:http-proxy-host=" + data[0])
60+
svn_command.append("--config-option")
61+
svn_command.append("servers:global:http-proxy-port=" + data[1])
62+
63+
no_proxy = self.env.get('no_proxy')
64+
if no_proxy:
65+
svn_command.append("--config-option")
66+
svn_command.append("servers:global:http-proxy-exceptions=" +
67+
no_proxy)
68+
69+
svn_command.append("update")
70+
cmd = Command(svn_command, work_dir=self.path, env_vars=self.env)
4671
cmd.execute()
4772
self.logger.info(cmd.getoutputstr())
4873
if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED:

0 commit comments

Comments
 (0)