--- 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
--- 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
--- 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)
--- 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)
--- 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
--- 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
--- 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