mercurial/chgserver.py
changeset 30635 a150173da1c1
parent 30619 88efb4fb1975
child 30643 dfb19aed409e
--- a/mercurial/chgserver.py	Sun Dec 18 01:34:41 2016 +0530
+++ b/mercurial/chgserver.py	Sun Dec 18 01:46:39 2016 +0530
@@ -55,6 +55,7 @@
 from . import (
     cmdutil,
     commandserver,
+    encoding,
     error,
     extensions,
     osutil,
@@ -102,7 +103,8 @@
     for section in _configsections:
         sectionitems.append(ui.configitems(section))
     sectionhash = _hashlist(sectionitems)
-    envitems = [(k, v) for k, v in os.environ.iteritems() if _envre.match(k)]
+    envitems = [(k, v) for k, v in encoding.environ.iteritems()
+                if _envre.match(k)]
     envhash = _hashlist(sorted(envitems))
     return sectionhash[:6] + envhash[:6]
 
@@ -177,7 +179,7 @@
     if not ui.formatted():
         return
 
-    p = ui.config("pager", "pager", os.environ.get("PAGER"))
+    p = ui.config("pager", "pager", encoding.environ.get("PAGER"))
     usepager = False
     always = util.parsebool(options['pager'])
     auto = options['pager'] == 'auto'
@@ -237,7 +239,7 @@
                 if val is True:
                     return '1'
                 return str(val)
-            env = os.environ.copy()
+            env = encoding.environ.copy()
             if environ:
                 env.update((k, py2shell(v)) for k, v in environ.iteritems())
             env['HG'] = util.hgexecutable()
@@ -512,8 +514,8 @@
         except ValueError:
             raise ValueError('unexpected value in setenv request')
         _log('setenv: %r\n' % sorted(newenv.keys()))
-        os.environ.clear()
-        os.environ.update(newenv)
+        encoding.environ.clear()
+        encoding.environ.update(newenv)
 
     capabilities = commandserver.server.capabilities.copy()
     capabilities.update({'attachio': attachio,
@@ -628,8 +630,8 @@
 def chgunixservice(ui, repo, opts):
     # CHGINTERNALMARK is temporarily set by chg client to detect if chg will
     # start another chg. drop it to avoid possible side effects.
-    if 'CHGINTERNALMARK' in os.environ:
-        del os.environ['CHGINTERNALMARK']
+    if 'CHGINTERNALMARK' in encoding.environ:
+        del encoding.environ['CHGINTERNALMARK']
 
     if repo:
         # one chgserver can serve multiple repos. drop repo information