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