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

Yuya Nishihara yuya at tcha.org
Thu Nov 3 23:43:41 EDT 2016


On Thu, 03 Nov 2016 03:53:10 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1478120266 -19800
> #      Thu Nov 03 02:27:46 2016 +0530
> # Node ID 9e259e7b59b6358eb842eabbc99f4c18a4cc5009
> # Parent  e0e794c3b580b1f64d37ccdd6d8bd606eb87880e
> 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 e0e794c3b580 -r 9e259e7b59b6 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):

Same here. We would probably want pycompat.pathsep?


More information about the Mercurial-devel mailing list