diff mercurial/url.py @ 15081:d30ec2d16c5a

merge with stable
author Matt Mackall <mpm@selenic.com>
date Sat, 10 Sep 2011 17:56:42 -0500
parents 1e45b92f4fb2 02734d2baa79
children 525fdb738975
line wrap: on
line diff
--- a/mercurial/url.py	Sat Aug 13 00:08:26 2011 +0200
+++ b/mercurial/url.py	Sat Sep 10 17:56:42 2011 -0500
@@ -93,13 +93,15 @@
             proxies = {}
 
         # urllib2 takes proxy values from the environment and those
-        # will take precedence if found, so drop them
-        for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
-            try:
-                if env in os.environ:
-                    del os.environ[env]
-            except OSError:
-                pass
+        # will take precedence if found. So, if there's a config entry
+        # defining a proxy, drop the environment ones
+        if ui.config("http_proxy", "host"):
+            for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
+                try:
+                    if env in os.environ:
+                        del os.environ[env]
+                except OSError:
+                    pass
 
         urllib2.ProxyHandler.__init__(self, proxies)
         self.ui = ui