[PATCH 1 of 4 RFC path options] ui: don't treat path sub-options as paths

Gregory Szorc gregory.szorc at gmail.com
Sun Mar 1 23:23:45 UTC 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1425249259 28800
#      Sun Mar 01 14:34:19 2015 -0800
# Node ID 7fc8f6c277f60658bfbceb0bb8c24aad07f0845f
# Parent  793958efbccccda02e6a008b06c7f2530afc89b5
ui: don't treat path sub-options as paths

ui.fixconfig() treats all options as paths and performs some
normalization during config load time. As we're about to introduce
sub-options, this could potentially interfere with the definition
of sub-options. So, exclude sub-options from normalization.

It's worth noting that this section of fixconfig() could likely
be moved to the new "paths" API someday. Ignore it for now.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -188,8 +188,12 @@ class ui(object):
             for c in self._tcfg, self._ucfg, self._ocfg:
                 for n, p in c.items('paths'):
                     if not p:
                         continue
+                    # Don't normalize sub-option values since they aren't
+                    # paths.
+                    if '.' in n:
+                        continue
                     if '%%' in p:
                         self.warn(_("(deprecated '%%' in path %s=%s from %s)\n")
                                   % (n, p, self.configsource('paths', n)))
                         p = p.replace('%%', '%')


More information about the Mercurial-devel mailing list