[PATCH 1 of 2] ui: don't fixup [paths] sub-options

Gregory Szorc gregory.szorc at gmail.com
Mon Dec 7 08:03:10 UTC 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1449474077 28800
#      Sun Dec 06 23:41:17 2015 -0800
# Node ID e9487562e005c6d112240199c023a0b6f79add2d
# Parent  c1fdf2875b0ea2407b80a11b3fc07b15c50c56d4
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
@@ -206,16 +206,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):


More information about the Mercurial-devel mailing list