diff mercurial/profiling.py @ 30820:6a70cf94d1b5

py3: replace pycompat.getenv with encoding.environ.get pycompat.getenv returns os.getenvb on py3 which is not available on Windows. This patch replaces them with encoding.environ.get and checks to ensure no new instances of os.getenv or os.setenv are introduced.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 15 Jan 2017 13:17:05 +0530
parents 69acfd2ca11e
children 517bc1cd7033
line wrap: on
line diff
--- a/mercurial/profiling.py	Sun Jan 15 16:33:15 2017 +0900
+++ b/mercurial/profiling.py	Sun Jan 15 13:17:05 2017 +0530
@@ -12,8 +12,8 @@
 
 from .i18n import _
 from . import (
+    encoding,
     error,
-    pycompat,
     util,
 )
 
@@ -120,7 +120,7 @@
     Profiling is active when the context manager is active. When the context
     manager exits, profiling results will be written to the configured output.
     """
-    profiler = pycompat.osgetenv('HGPROF')
+    profiler = encoding.environ.get('HGPROF')
     if profiler is None:
         profiler = ui.config('profiling', 'type', default='stat')
     if profiler not in ('ls', 'stat', 'flame'):