changeset 30318:af7c60988f6e

py3: make scmutil.rcpath() return bytes This patch make sure scmutil.rcpath() returns bytes independent of which platform is used on Python 3. If we want to change type for windows we can just conditionalize the return variable.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 06 Nov 2016 04:17:19 +0530
parents ba2c04059317
children 5581b294f3c6
files mercurial/scmutil.py tests/test-check-py3-commands.t
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sun Nov 06 04:10:33 2016 +0530
+++ b/mercurial/scmutil.py	Sun Nov 06 04:17:19 2016 +0530
@@ -27,6 +27,7 @@
     osutil,
     pathutil,
     phases,
+    pycompat,
     revset,
     similar,
     util,
@@ -755,7 +756,7 @@
     if _rcpath is None:
         if 'HGRCPATH' in encoding.environ:
             _rcpath = []
-            for p in os.environ['HGRCPATH'].split(os.pathsep):
+            for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
                 if not p:
                     continue
                 p = util.expandpath(p)
--- a/tests/test-check-py3-commands.t	Sun Nov 06 04:10:33 2016 +0530
+++ b/tests/test-check-py3-commands.t	Sun Nov 06 04:17:19 2016 +0530
@@ -9,6 +9,6 @@
   >   $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1
   > done
   version
-  TypeError: str expected, not bytes
+  TypeError: startswith first arg must be str or a tuple of str, not bytes
   debuginstall
-  TypeError: str expected, not bytes
+  TypeError: startswith first arg must be str or a tuple of str, not bytes