comparison mercurial/scmposix.py @ 32208:d74b0cff94a9

osutil: proxy through util (and platform) modules (API) See the previous commit for why. Marked as API change since osutil.listdir() seems widely used in third-party extensions. The win32mbcs extension is updated to wrap both util. and windows. aliases.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Apr 2017 22:26:28 +0900
parents bf5e13e38390
children dacfcdd8b94e
comparison
equal deleted inserted replaced
32203:0c73634d0570 32208:d74b0cff94a9
6 import os 6 import os
7 import sys 7 import sys
8 8
9 from . import ( 9 from . import (
10 encoding, 10 encoding,
11 osutil,
12 pycompat, 11 pycompat,
12 util,
13 ) 13 )
14 14
15 # BSD 'more' escapes ANSI color sequences by default. This can be disabled by 15 # BSD 'more' escapes ANSI color sequences by default. This can be disabled by
16 # $MORE variable, but there's no compatible option with Linux 'more'. Given 16 # $MORE variable, but there's no compatible option with Linux 'more'. Given
17 # OS X is widely used and most modern Unix systems would have 'less', setting 17 # OS X is widely used and most modern Unix systems would have 'less', setting
21 def _rcfiles(path): 21 def _rcfiles(path):
22 rcs = [os.path.join(path, 'hgrc')] 22 rcs = [os.path.join(path, 'hgrc')]
23 rcdir = os.path.join(path, 'hgrc.d') 23 rcdir = os.path.join(path, 'hgrc.d')
24 try: 24 try:
25 rcs.extend([os.path.join(rcdir, f) 25 rcs.extend([os.path.join(rcdir, f)
26 for f, kind in osutil.listdir(rcdir) 26 for f, kind in util.listdir(rcdir)
27 if f.endswith(".rc")]) 27 if f.endswith(".rc")])
28 except OSError: 28 except OSError:
29 pass 29 pass
30 return rcs 30 return rcs
31 31