py3: replace os.environ with encoding.environ (part 5 of 5)
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 18 Dec 2016 02:08:59 +0530
changeset 30638 1c5cbf28f007
parent 30637 344e68882cd3
child 30639 d524c88511a7
py3: replace os.environ with encoding.environ (part 5 of 5)
hgext/color.py
hgext/convert/cvs.py
hgext/convert/cvsps.py
hgext/logtoprocess.py
--- a/hgext/color.py	Sun Dec 18 02:06:00 2016 +0530
+++ b/hgext/color.py	Sun Dec 18 02:08:59 2016 +0530
@@ -171,6 +171,7 @@
     cmdutil,
     commands,
     dispatch,
+    encoding,
     extensions,
     subrepo,
     ui as uimod,
@@ -245,7 +246,8 @@
     if not always and not auto:
         return None
 
-    formatted = always or (os.environ.get('TERM') != 'dumb' and ui.formatted())
+    formatted = (always or (encoding.environ.get('TERM') != 'dumb'
+                 and ui.formatted()))
 
     mode = ui.config('color', 'mode', 'auto')
 
@@ -256,7 +258,7 @@
     realmode = mode
     if mode == 'auto':
         if os.name == 'nt':
-            term = os.environ.get('TERM')
+            term = encoding.environ.get('TERM')
             # TERM won't be defined in a vanilla cmd.exe environment.
 
             # UNIX-like environments on Windows such as Cygwin and MSYS will
--- a/hgext/convert/cvs.py	Sun Dec 18 02:06:00 2016 +0530
+++ b/hgext/convert/cvs.py	Sun Dec 18 02:08:59 2016 +0530
@@ -189,7 +189,7 @@
 
         if conntype != "pserver":
             if conntype == "rsh":
-                rsh = os.environ.get("CVS_RSH") or "ssh"
+                rsh = encoding.environ.get("CVS_RSH") or "ssh"
                 if user:
                     cmd = [rsh, '-l', user, host] + cmd
                 else:
--- a/hgext/convert/cvsps.py	Sun Dec 18 02:06:00 2016 +0530
+++ b/hgext/convert/cvsps.py	Sun Dec 18 02:08:59 2016 +0530
@@ -11,6 +11,7 @@
 
 from mercurial.i18n import _
 from mercurial import (
+    encoding,
     hook,
     pycompat,
     util,
@@ -147,7 +148,7 @@
             pass
 
     if not root:
-        root = os.environ.get('CVSROOT', '')
+        root = encoding.environ.get('CVSROOT', '')
 
     # read log cache if one exists
     oldlog = []
--- a/hgext/logtoprocess.py	Sun Dec 18 02:06:00 2016 +0530
+++ b/hgext/logtoprocess.py	Sun Dec 18 02:08:59 2016 +0530
@@ -40,6 +40,8 @@
 import subprocess
 import sys
 
+from mercurial import encoding
+
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
@@ -117,7 +119,7 @@
                 optpairs = (
                     ('OPT_{0}'.format(key.upper()), str(value))
                     for key, value in opts.iteritems())
-                env = dict(itertools.chain(os.environ.items(),
+                env = dict(itertools.chain(encoding.environ.items(),
                                            msgpairs, optpairs),
                            EVENT=event, HGPID=str(os.getpid()))
                 # Connect stdin to /dev/null to prevent child processes messing