comparison mercurial/util.py @ 9610:d78fe60f6bda

make path expanding more consistent This expands ~user and $FOO constructs in ui.ignore files, [defaults], [paths], extension paths, and HGRCPATH files.
author Alexander Solovyov <piranha@piranha.org.ua>
date Mon, 19 Oct 2009 22:19:28 +0300
parents ceb0f59e1327
children 16698d87ad20
comparison
equal deleted inserted replaced
9609:aa404f3f661b 9610:d78fe60f6bda
1156 if _rcpath is None: 1156 if _rcpath is None:
1157 if 'HGRCPATH' in os.environ: 1157 if 'HGRCPATH' in os.environ:
1158 _rcpath = [] 1158 _rcpath = []
1159 for p in os.environ['HGRCPATH'].split(os.pathsep): 1159 for p in os.environ['HGRCPATH'].split(os.pathsep):
1160 if not p: continue 1160 if not p: continue
1161 p = expandpath(p)
1161 if os.path.isdir(p): 1162 if os.path.isdir(p):
1162 for f, kind in osutil.listdir(p): 1163 for f, kind in osutil.listdir(p):
1163 if f.endswith('.rc'): 1164 if f.endswith('.rc'):
1164 _rcpath.append(os.path.join(p, f)) 1165 _rcpath.append(os.path.join(p, f))
1165 else: 1166 else:
1248 1249
1249 def iterlines(iterator): 1250 def iterlines(iterator):
1250 for chunk in iterator: 1251 for chunk in iterator:
1251 for line in chunk.splitlines(): 1252 for line in chunk.splitlines():
1252 yield line 1253 yield line
1254
1255 def expandpath(path):
1256 return os.path.expanduser(os.path.expandvars(path))