[PATCH 1 of 3 RFC] ui: expand paths more consistently in configpath()
Greg Ward
greg-hg at gerg.ca
Sun Oct 23 21:29:28 CDT 2011
# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1319422202 14400
# Branch stable
# Node ID 355886191fae0c2dc21bd8fa4670de2da86b4caf
# Parent b4d2bf85c41f38a7571022b8d77c4402b558bc74
ui: expand paths more consistently in configpath()
- use util.expandpath() so we expand environment variables
in addition to "~/"
- call it earlier so it's guaranteed to happen (if the user
actually supplied a value, that is)
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -180,11 +180,12 @@
v = self.config(section, name, default, untrusted)
if v is None:
return None
+ v = util.expandpath(v)
if not os.path.isabs(v) or "://" not in v:
src = self.configsource(section, name, untrusted)
if ':' in src:
base = os.path.dirname(src.rsplit(':')[0])
- v = os.path.join(base, os.path.expanduser(v))
+ v = os.path.join(base, v)
return v
def configbool(self, section, name, default=False, untrusted=False):
More information about the Mercurial-devel
mailing list