Show More
@@ -98,12 +98,21 b' class ui(object):' | |||
|
98 | 98 | self.fixconfig(root=root) |
|
99 | 99 | |
|
100 | 100 | def fixconfig(self, root=None): |
|
101 | # expand vars and ~ | |
|
101 | 102 | # translate paths relative to root (or home) into absolute paths |
|
102 | 103 | root = root or os.getcwd() |
|
103 | 104 | for c in self._tcfg, self._ucfg, self._ocfg: |
|
104 | 105 | for n, p in c.items('paths'): |
|
105 | if p and "://" not in p and not os.path.isabs(p): | |
|
106 | c.set("paths", n, os.path.normpath(os.path.join(root, p))) | |
|
106 | if not p: | |
|
107 | continue | |
|
108 | if '%%' in p: | |
|
109 | self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") | |
|
110 | % (n, p, self.configsource('paths', n))) | |
|
111 | p = p.replace('%%', '%') | |
|
112 | p = util.expandpath(p) | |
|
113 | if '://' not in p and not os.path.isabs(p): | |
|
114 | p = os.path.normpath(os.path.join(root, p)) | |
|
115 | c.set("paths", n, p) | |
|
107 | 116 | |
|
108 | 117 | # update ui options |
|
109 | 118 | self.debugflag = self.configbool('ui', 'debug') |
@@ -300,24 +309,14 b' class ui(object):' | |||
|
300 | 309 | user = util.shortuser(user) |
|
301 | 310 | return user |
|
302 | 311 | |
|
303 | def _path(self, loc): | |
|
304 | p = self.config('paths', loc) | |
|
305 | if p: | |
|
306 | if '%%' in p: | |
|
307 | self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") % | |
|
308 | (loc, p, self.configsource('paths', loc))) | |
|
309 | p = p.replace('%%', '%') | |
|
310 | p = util.expandpath(p) | |
|
311 | return p | |
|
312 | ||
|
313 | 312 | def expandpath(self, loc, default=None): |
|
314 | 313 | """Return repository location relative to cwd or from [paths]""" |
|
315 | 314 | if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')): |
|
316 | 315 | return loc |
|
317 | 316 | |
|
318 |
path = self. |
|
|
317 | path = self.config('paths', loc) | |
|
319 | 318 | if not path and default is not None: |
|
320 |
path = self. |
|
|
319 | path = self.config('paths', default) | |
|
321 | 320 | return path or loc |
|
322 | 321 | |
|
323 | 322 | def pushbuffer(self): |
@@ -5,6 +5,7 b'' | |||
|
5 | 5 | $ cd a |
|
6 | 6 | $ echo '[paths]' >> .hg/hgrc |
|
7 | 7 | $ echo 'dupe = ../b' >> .hg/hgrc |
|
8 | $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc | |
|
8 | 9 | $ hg in dupe |
|
9 | 10 | comparing with $TESTTMP/b |
|
10 | 11 | no changes found |
@@ -14,3 +15,13 b'' | |||
|
14 | 15 | comparing with $TESTTMP/b |
|
15 | 16 | no changes found |
|
16 | 17 | [1] |
|
18 | $ cd a | |
|
19 | $ hg paths | |
|
20 | dupe = $TESTTMP/b | |
|
21 | expand = $TESTTMP/a/$SOMETHING/bar | |
|
22 | $ SOMETHING=foo hg paths | |
|
23 | dupe = $TESTTMP/b | |
|
24 | expand = $TESTTMP/a/foo/bar | |
|
25 | $ SOMETHING=/foo hg paths | |
|
26 | dupe = $TESTTMP/b | |
|
27 | expand = /foo/bar |
General Comments 0
You need to be logged in to leave comments.
Login now