# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1482006276 -19800 # Node ID f1c9fafcbf46a2a9d8c1e7333ab0f076b1c7cb1d # Parent a150173da1c12a290fa94dee0695e419040c22fe py3: replace os.environ with encoding.environ (part 3 of 5) diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/filemerge.py --- a/mercurial/filemerge.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/filemerge.py Sun Dec 18 01:54:36 2016 +0530 @@ -16,6 +16,7 @@ from .node import nullid, short from . import ( + encoding, error, formatter, match, @@ -165,7 +166,7 @@ return (force, force) # HGMERGE takes next precedence - hgmerge = os.environ.get("HGMERGE") + hgmerge = encoding.environ.get("HGMERGE") if hgmerge: if changedelete and not supportscd(hgmerge): return ":prompt", None diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/hgweb/common.py Sun Dec 18 01:54:36 2016 +0530 @@ -13,6 +13,7 @@ import os from .. import ( + encoding, pycompat, util, ) @@ -191,7 +192,7 @@ """ return (config("web", "contact") or config("ui", "username") or - os.environ.get("EMAIL") or "") + encoding.environ.get("EMAIL") or "") def caching(web, req): tag = 'W/"%s"' % web.mtime diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/hgweb/hgweb_mod.py Sun Dec 18 01:54:36 2016 +0530 @@ -286,7 +286,8 @@ Modern servers should be using WSGI and should avoid this method, if possible. """ - if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): + if not encoding.environ.get('GATEWAY_INTERFACE', + '').startswith("CGI/1."): raise RuntimeError("This function is only intended to be " "called while running as a CGI script.") wsgicgi.launch(self) diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/hgweb/hgwebdir_mod.py Sun Dec 18 01:54:36 2016 +0530 @@ -186,7 +186,8 @@ self.lastrefresh = time.time() def run(self): - if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): + if not encoding.environ.get('GATEWAY_INTERFACE', + '').startswith("CGI/1."): raise RuntimeError("This function is only intended to be " "called while running as a CGI script.") wsgicgi.launch(self) diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/hgweb/wsgicgi.py --- a/mercurial/hgweb/wsgicgi.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/hgweb/wsgicgi.py Sun Dec 18 01:54:36 2016 +0530 @@ -10,9 +10,8 @@ from __future__ import absolute_import -import os - from .. import ( + encoding, util, ) @@ -24,7 +23,7 @@ util.setbinary(util.stdin) util.setbinary(util.stdout) - environ = dict(os.environ.iteritems()) + environ = dict(encoding.environ.iteritems()) environ.setdefault('PATH_INFO', '') if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'): # IIS includes script_name in PATH_INFO diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/url.py --- a/mercurial/url.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/url.py Sun Dec 18 01:54:36 2016 +0530 @@ -15,6 +15,7 @@ from .i18n import _ from . import ( + encoding, error, httpconnection as httpconnectionmod, keepalive, @@ -118,8 +119,8 @@ 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] + if env in encoding.environ: + del encoding.environ[env] except OSError: pass diff -r a150173da1c1 -r f1c9fafcbf46 mercurial/windows.py --- a/mercurial/windows.py Sun Dec 18 01:46:39 2016 +0530 +++ b/mercurial/windows.py Sun Dec 18 01:54:36 2016 +0530 @@ -177,7 +177,7 @@ try: return sys.getwindowsversion()[3] == 1 except AttributeError: - return 'command' in os.environ.get('comspec', '') + return 'command' in encoding.environ.get('comspec', '') def openhardlinks(): return not _is_win_9x() @@ -303,7 +303,7 @@ PATH isn't searched if command is an absolute or relative path. An extension from PATHEXT is found and added if not present. If command isn't found None is returned.''' - pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD') + pathext = encoding.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD') pathexts = [ext for ext in pathext.lower().split(pycompat.ospathsep)] if os.path.splitext(command)[1].lower() in pathexts: pathexts = [''] @@ -319,7 +319,7 @@ if pycompat.ossep in command: return findexisting(command) - for path in os.environ.get('PATH', '').split(pycompat.ospathsep): + for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep): executable = findexisting(os.path.join(path, command)) if executable is not None: return executable