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

login
register
mail settings
Submitter Gregory Szorc
Date March 1, 2015, 11:23 p.m.
Message ID <7fc8f6c277f60658bfbc.1425252225@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/7871/
State Deferred
Headers show

Comments

Gregory Szorc - March 1, 2015, 11:23 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.

Patch

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('%%', '%')