comparison mercurial/scmposix.py @ 30276:c90a05124fae

py3: make scmposix.userrcpath() return bytes We are making sure that we deal with bytes as much we can. This is a part of fixing functions so that they return bytes if they have to. Used encoding.environ to return bytes. After this patch, scmposix.userrcpath() returns bytes and scmutil.osrcpath() will also return bytes if the platform is posix. Functions is scmposix returns bytes on Python 3 now.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 03 Nov 2016 02:17:01 +0530
parents 39087ee88835
children 4b1af1c867fa
comparison
equal deleted inserted replaced
30275:e81d72b4b0ae 30276:c90a05124fae
2 2
3 import os 3 import os
4 import sys 4 import sys
5 5
6 from . import ( 6 from . import (
7 encoding,
7 osutil, 8 osutil,
8 ) 9 )
9 10
10 def _rcfiles(path): 11 def _rcfiles(path):
11 rcs = [os.path.join(path, 'hgrc')] 12 rcs = [os.path.join(path, 'hgrc')]
32 path.extend(_rcfiles('/' + root)) 33 path.extend(_rcfiles('/' + root))
33 return path 34 return path
34 35
35 def userrcpath(): 36 def userrcpath():
36 if sys.platform == 'plan9': 37 if sys.platform == 'plan9':
37 return [os.environ['home'] + '/lib/hgrc'] 38 return [encoding.environ['home'] + '/lib/hgrc']
38 else: 39 else:
39 return [os.path.expanduser('~/.hgrc')] 40 return [os.path.expanduser('~/.hgrc')]