# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1482007139 -19800 # Node ID 1c5cbf28f0071af78c89245356db396caf5ed789 # Parent 344e68882cd3b2003a12aa8c90e291fd9456e160 py3: replace os.environ with encoding.environ (part 5 of 5) diff -r 344e68882cd3 -r 1c5cbf28f007 hgext/color.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 diff -r 344e68882cd3 -r 1c5cbf28f007 hgext/convert/cvs.py --- 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: diff -r 344e68882cd3 -r 1c5cbf28f007 hgext/convert/cvsps.py --- 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 = [] diff -r 344e68882cd3 -r 1c5cbf28f007 hgext/logtoprocess.py --- 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