# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1482005799 -19800
#      Sun Dec 18 01:46:39 2016 +0530
# Node ID c1a8b0e2a088a8cd365f7aa6a3f5d609fc57a92f
# Parent  961ff24b8c2f9d71ff8f5d6539f760e78d88d07a
py3: replace os.environ with encoding.environ (part 2 of 5)

diff -r 961ff24b8c2f -r c1a8b0e2a088 mercurial/chgserver.py
--- 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()
@@ -515,8 +517,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,
@@ -626,8 +628,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
diff -r 961ff24b8c2f -r c1a8b0e2a088 mercurial/sshserver.py
--- a/mercurial/sshserver.py    Sun Dec 18 01:34:41 2016 +0530
+++ b/mercurial/sshserver.py    Sun Dec 18 01:46:39 2016 +0530
@@ -8,11 +8,11 @@
 
 from __future__ import absolute_import
 
-import os
 import sys
 
 from .i18n import _
 from . import (
+    encoding,
     error,
     hook,
     util,
@@ -131,5 +131,5 @@
         return cmd != ''
 
     def _client(self):
-        client = os.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
+        client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
         return 'remote:ssh:' + client
diff -r 961ff24b8c2f -r c1a8b0e2a088 mercurial/subrepo.py
--- a/mercurial/subrepo.py      Sun Dec 18 01:34:41 2016 +0530
+++ b/mercurial/subrepo.py      Sun Dec 18 01:46:39 2016 +0530
@@ -24,6 +24,7 @@
 from . import (
     cmdutil,
     config,
+    encoding,
     error,
     exchange,
     filemerge,
@@ -1102,7 +1103,7 @@
             path = self.wvfs.reljoin(self._ctx.repo().origroot,
                                      self._path, filename)
             cmd.append(path)
-        env = dict(os.environ)
+        env = dict(encoding.environ)
         # Avoid localized output, preserve current locale for everything else.
         lc_all = env.get('LC_ALL')
         if lc_all:
@@ -1398,7 +1399,7 @@
         """
         self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands)))
         if env is None:
-            env = os.environ.copy()
+            env = encoding.environ.copy()
         # disable localization for Git output (issue5176)
         env['LC_ALL'] = 'C'
         # fix for Git CVE-2015-7545
@@ -1633,7 +1634,7 @@
         if self._gitmissing():
             raise error.Abort(_("subrepo %s is missing") % self._relpath)
         cmd = ['commit', '-a', '-m', text]
-        env = os.environ.copy()
+        env = encoding.environ.copy()
         if user:
             cmd += ['--author', user]
         if date:
diff -r 961ff24b8c2f -r c1a8b0e2a088 mercurial/worker.py
--- a/mercurial/worker.py       Sun Dec 18 01:34:41 2016 +0530
+++ b/mercurial/worker.py       Sun Dec 18 01:46:39 2016 +0530
@@ -14,6 +14,7 @@
 
 from .i18n import _
 from . import (
+    encoding,
     error,
     scmutil,
     util,
@@ -32,7 +33,7 @@
 
     # windows
     try:
-        n = int(os.environ['NUMBER_OF_PROCESSORS'])
+        n = int(encoding.environ['NUMBER_OF_PROCESSORS'])
         if n > 0:
             return n
     except (KeyError, ValueError):
diff -r 961ff24b8c2f -r c1a8b0e2a088 tests/test-check-config.t
--- a/tests/test-check-config.t Sun Dec 18 01:34:41 2016 +0530
+++ b/tests/test-check-config.t Sun Dec 18 01:46:39 2016 +0530
@@ -7,3 +7,6 @@
 
   $ hg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
   >   python contrib/check-config.py
+      p = ui.config("pager", "pager", encoding.environ.get("PAGER"))
+  
+  conflict on pager.pager: ('str', 'encoding.environ.get("PAGER"') != ('str', 
'os.environ.get("PAGER"')
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to