[PATCH 1 of 2 V2] ui: don't fixup [paths] sub-options
Gregory Szorc
gregory.szorc at gmail.com
Sun Jun 26 01:51:13 UTC 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1466904914 25200
# Sat Jun 25 18:35:14 2016 -0700
# Node ID b4d373225616128b6d8b29ba893976504c4f79c9
# Parent fbe380dc227a0240939aa5a4941eda70d958ea40
ui: don't fixup [paths] sub-options
As part of developing a subsequent patch I discovered that sub-option
values like "." were getting converted to paths. This is because the
[paths] section is treated specially during config loading.
This patch prevents post-processing sub-options from the [paths]
section.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -223,16 +223,19 @@ class ui(object):
def fixconfig(self, root=None, section=None):
if section in (None, 'paths'):
# expand vars and ~
# translate paths relative to root (or home) into absolute paths
root = root or os.getcwd()
for c in self._tcfg, self._ucfg, self._ocfg:
for n, p in c.items('paths'):
+ # Ignore sub-options.
+ if ':' in n:
+ continue
if not p:
continue
if '%%' in p:
self.warn(_("(deprecated '%%' in path %s=%s from %s)\n")
% (n, p, self.configsource('paths', n)))
p = p.replace('%%', '%')
p = util.expandpath(p)
if not util.hasscheme(p) and not os.path.isabs(p):
diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -85,8 +85,20 @@ Test "%unset"
$ hg showconfig unsettest
unsettest.set-after-unset=should be set (.hg/hgrc)
Test exit code when no config matches
$ hg config Section.idontexist
[1]
+
+sub-options in [paths] aren't expanded
+
+ $ cat > .hg/hgrc << EOF
+ > [paths]
+ > foo = ~/foo
+ > foo:suboption = ~/foo
+ > EOF
+
+ $ hg showconfig paths
+ paths.foo:suboption=~/foo
+ paths.foo=$TESTTMP/foo
More information about the Mercurial-devel
mailing list