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

login
register
mail settings
Submitter Pulkit Goyal
Date Nov. 2, 2016, 10:15 p.m.
Message ID <495481800cc65bddf8a9.1478124919@pulkit-goyal>
Download mbox | patch
Permalink /patch/17295/
State Superseded
Headers show

Comments

Pulkit Goyal - Nov. 2, 2016, 10:15 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@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.

Patch

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)