# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-12-17 20:38:59 # Node ID 1c5cbf28f0071af78c89245356db396caf5ed789 # Parent 344e68882cd3b2003a12aa8c90e291fd9456e160 py3: replace os.environ with encoding.environ (part 5 of 5) diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -171,6 +171,7 @@ from mercurial import ( cmdutil, commands, dispatch, + encoding, extensions, subrepo, ui as uimod, @@ -245,7 +246,8 @@ def _modesetup(ui, coloropt): 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 @@ def _modesetup(ui, coloropt): 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 diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -189,7 +189,7 @@ class convert_cvs(converter_source): 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: diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -11,6 +11,7 @@ import re from mercurial.i18n import _ from mercurial import ( + encoding, hook, pycompat, util, @@ -147,7 +148,7 @@ def createlog(ui, directory=None, root=" pass if not root: - root = os.environ.get('CVSROOT', '') + root = encoding.environ.get('CVSROOT', '') # read log cache if one exists oldlog = [] diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py --- a/hgext/logtoprocess.py +++ b/hgext/logtoprocess.py @@ -40,6 +40,8 @@ import platform 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 @@ def uisetup(ui): 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