Show More
@@ -465,9 +465,10 b' py3pats = [' | |||
|
465 | 465 | (r'os\.sep', "use pycompat.ossep instead (py3)"), |
|
466 | 466 | (r'os\.pathsep', "use pycompat.ospathsep instead (py3)"), |
|
467 | 467 | (r'os\.altsep', "use pycompat.osaltsep instead (py3)"), |
|
468 | (r'os\.getenv', "use pycompat.osgetenv instead (py3)"), | |
|
469 | 468 | (r'sys\.platform', "use pycompat.sysplatform instead (py3)"), |
|
470 | 469 | (r'getopt\.getopt', "use pycompat.getoptb instead (py3)"), |
|
470 | (r'os\.getenv', "use encoding.environ.get instead"), | |
|
471 | (r'os\.setenv', "modifying the environ dict is not preferred"), | |
|
471 | 472 | ], |
|
472 | 473 | # warnings |
|
473 | 474 | [], |
@@ -19,6 +19,7 b' from mercurial.i18n import _' | |||
|
19 | 19 | |
|
20 | 20 | from mercurial import ( |
|
21 | 21 | dirstate, |
|
22 | encoding, | |
|
22 | 23 | error, |
|
23 | 24 | httpconnection, |
|
24 | 25 | match as matchmod, |
@@ -74,19 +75,19 b' def _usercachedir(ui):' | |||
|
74 | 75 | if path: |
|
75 | 76 | return path |
|
76 | 77 | if pycompat.osname == 'nt': |
|
77 |
appdata = |
|
|
78 |
|
|
|
78 | appdata = encoding.environ.get('LOCALAPPDATA',\ | |
|
79 | encoding.environ.get('APPDATA')) | |
|
79 | 80 | if appdata: |
|
80 | 81 | return os.path.join(appdata, longname) |
|
81 | 82 | elif platform.system() == 'Darwin': |
|
82 |
home = |
|
|
83 | home = encoding.environ.get('HOME') | |
|
83 | 84 | if home: |
|
84 | 85 | return os.path.join(home, 'Library', 'Caches', longname) |
|
85 | 86 | elif pycompat.osname == 'posix': |
|
86 |
path = |
|
|
87 | path = encoding.environ.get('XDG_CACHE_HOME') | |
|
87 | 88 | if path: |
|
88 | 89 | return os.path.join(path, longname) |
|
89 |
home = |
|
|
90 | home = encoding.environ.get('HOME') | |
|
90 | 91 | if home: |
|
91 | 92 | return os.path.join(home, '.cache', longname) |
|
92 | 93 | else: |
@@ -12,8 +12,8 b' import time' | |||
|
12 | 12 | |
|
13 | 13 | from .i18n import _ |
|
14 | 14 | from . import ( |
|
15 | encoding, | |
|
15 | 16 | error, |
|
16 | pycompat, | |
|
17 | 17 | util, |
|
18 | 18 | ) |
|
19 | 19 | |
@@ -120,7 +120,7 b' def profile(ui):' | |||
|
120 | 120 | Profiling is active when the context manager is active. When the context |
|
121 | 121 | manager exits, profiling results will be written to the configured output. |
|
122 | 122 | """ |
|
123 |
profiler = |
|
|
123 | profiler = encoding.environ.get('HGPROF') | |
|
124 | 124 | if profiler is None: |
|
125 | 125 | profiler = ui.config('profiling', 'type', default='stat') |
|
126 | 126 | if profiler not in ('ls', 'stat', 'flame'): |
@@ -46,7 +46,6 b' if ispy3:' | |||
|
46 | 46 | ospathsep = os.pathsep.encode('ascii') |
|
47 | 47 | ossep = os.sep.encode('ascii') |
|
48 | 48 | osaltsep = os.altsep |
|
49 | osgetenv = os.getenvb | |
|
50 | 49 | if osaltsep: |
|
51 | 50 | osaltsep = osaltsep.encode('ascii') |
|
52 | 51 | # os.getcwd() on Python 3 returns string, but it has os.getcwdb() which |
@@ -169,7 +168,6 b' else:' | |||
|
169 | 168 | sysargv = sys.argv |
|
170 | 169 | sysplatform = sys.platform |
|
171 | 170 | getcwd = os.getcwd |
|
172 | osgetenv = os.getenv | |
|
173 | 171 | sysexecutable = sys.executable |
|
174 | 172 | shlexsplit = shlex.split |
|
175 | 173 |
@@ -15,10 +15,10 b' import socket' | |||
|
15 | 15 | |
|
16 | 16 | from .i18n import _ |
|
17 | 17 | from . import ( |
|
18 | encoding, | |
|
18 | 19 | error, |
|
19 | 20 | httpconnection as httpconnectionmod, |
|
20 | 21 | keepalive, |
|
21 | pycompat, | |
|
22 | 22 | sslutil, |
|
23 | 23 | util, |
|
24 | 24 | ) |
@@ -81,7 +81,7 b' class passwordmgr(object):' | |||
|
81 | 81 | class proxyhandler(urlreq.proxyhandler): |
|
82 | 82 | def __init__(self, ui): |
|
83 | 83 | proxyurl = (ui.config("http_proxy", "host") or |
|
84 |
|
|
|
84 | encoding.environ.get('http_proxy')) | |
|
85 | 85 | # XXX proxyauthinfo = None |
|
86 | 86 | |
|
87 | 87 | if proxyurl: |
@@ -99,7 +99,7 b' class proxyhandler(urlreq.proxyhandler):' | |||
|
99 | 99 | no_list.extend([p.lower() for |
|
100 | 100 | p in ui.configlist("http_proxy", "no")]) |
|
101 | 101 | no_list.extend([p.strip().lower() for |
|
102 |
p in |
|
|
102 | p in encoding.environ.get("no_proxy", '').split(',') | |
|
103 | 103 | if p.strip()]) |
|
104 | 104 | # "http_proxy.always" config is for running tests on localhost |
|
105 | 105 | if ui.configbool("http_proxy", "always"): |
General Comments 0
You need to be logged in to leave comments.
Login now