[PATCH 5 of 7] py3: make scmutil.rcpath() return bytes

Pulkit Goyal 7895pulkit at gmail.com
Wed Nov 2 18:15:19 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1478120266 -19800
#      Thu Nov 03 02:27:46 2016 +0530
# Node ID 495481800cc65bddf8a944ce0a091fef5972c6b9
# Parent  b0e4b8169c8f8080cee7648ddd8824025814e905
py3: make scmutil.rcpath() return bytes

In the whole series we are dealing with path varaibles which must be bytes
on UNIX. 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.

diff -r b0e4b8169c8f -r 495481800cc6 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Thu Nov 03 02:17:01 2016 +0530
+++ b/mercurial/scmutil.py	Thu Nov 03 02:27:46 2016 +0530
@@ -755,7 +755,8 @@
     if _rcpath is None:
         if 'HGRCPATH' in encoding.environ:
             _rcpath = []
-            for p in os.environ['HGRCPATH'].split(os.pathsep):
+            pathsep = os.pathsep.encode('ascii')
+            for p in encoding.environ['HGRCPATH'].split(pathsep):
                 if not p:
                     continue
                 p = util.expandpath(p)


More information about the Mercurial-devel mailing list