py3: make scmutil.rcpath() return bytes
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 06 Nov 2016 04:17:19 +0530
changeset 30305 af7c60988f6e
parent 30304 ba2c04059317
child 30306 5581b294f3c6
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.
mercurial/scmutil.py
tests/test-check-py3-commands.t
--- 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