##// END OF EJS Templates
make path expanding more consistent...
Alexander Solovyov -
r9610:d78fe60f default
parent child Browse files
Show More
@@ -100,7 +100,7 b' class dirstate(object):'
100 files = [self._join('.hgignore')]
100 files = [self._join('.hgignore')]
101 for name, path in self._ui.configitems("ui"):
101 for name, path in self._ui.configitems("ui"):
102 if name == 'ignore' or name.startswith('ignore.'):
102 if name == 'ignore' or name.startswith('ignore.'):
103 files.append(os.path.expanduser(path))
103 files.append(util.expandpath(path))
104 return ignore.ignore(self._root, files, self._ui.warn)
104 return ignore.ignore(self._root, files, self._ui.warn)
105
105
106 @propertycache
106 @propertycache
@@ -248,7 +248,7 b' def _parse(ui, args):'
248 args = aliasargs(i[0]) + args
248 args = aliasargs(i[0]) + args
249 defaults = ui.config("defaults", cmd)
249 defaults = ui.config("defaults", cmd)
250 if defaults:
250 if defaults:
251 args = shlex.split(defaults) + args
251 args = map(util.expandpath, shlex.split(defaults)) + args
252 c = list(i[1])
252 c = list(i[1])
253 else:
253 else:
254 cmd = None
254 cmd = None
@@ -477,8 +477,7 b' def _runcommand(ui, options, cmd, cmdfun'
477 output = ui.config('profiling', 'output')
477 output = ui.config('profiling', 'output')
478
478
479 if output:
479 if output:
480 path = os.path.expanduser(output)
480 path = ui.expandpath(output)
481 path = ui.expandpath(path)
482 ostream = open(path, 'wb')
481 ostream = open(path, 'wb')
483 else:
482 else:
484 ostream = sys.stderr
483 ostream = sys.stderr
@@ -30,7 +30,7 b' def find(name):'
30
30
31 def loadpath(path, module_name):
31 def loadpath(path, module_name):
32 module_name = module_name.replace('.', '_')
32 module_name = module_name.replace('.', '_')
33 path = os.path.expanduser(path)
33 path = util.expandpath(path)
34 if os.path.isdir(path):
34 if os.path.isdir(path):
35 # module/__init__.py style
35 # module/__init__.py style
36 d, f = os.path.split(path.rstrip('/'))
36 d, f = os.path.split(path.rstrip('/'))
@@ -198,10 +198,12 b' class ui(object):'
198
198
199 def _path(self, loc):
199 def _path(self, loc):
200 p = self.config('paths', loc)
200 p = self.config('paths', loc)
201 if p and '%%' in p:
201 if p:
202 self.warn("(deprecated '%%' in path %s=%s from %s)\n" %
202 if '%%' in p:
203 (loc, p, self.configsource('paths', loc)))
203 self.warn("(deprecated '%%' in path %s=%s from %s)\n" %
204 p = p.replace('%%', '%')
204 (loc, p, self.configsource('paths', loc)))
205 p = p.replace('%%', '%')
206 p = util.expandpath(p)
205 return p
207 return p
206
208
207 def expandpath(self, loc, default=None):
209 def expandpath(self, loc, default=None):
@@ -1158,6 +1158,7 b' def rcpath():'
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'):
@@ -1250,3 +1251,6 b' 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))
General Comments 0
You need to be logged in to leave comments. Login now