Patchwork [06,of,10,RFC,v2] dispatch: modernize the ui after finalizing config loading

login
register
mail settings
Submitter David Soria Parra
Date March 12, 2017, 10:40 p.m.
Message ID <63065d4cb13dc3acb917.1489358429@davidsp-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/19249/
State Changes Requested
Headers show

Comments

David Soria Parra - March 12, 2017, 10:40 p.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1489349206 25200
#      Sun Mar 12 13:06:46 2017 -0700
# Node ID 63065d4cb13dc3acb9177473896fc3c9c9c7993b
# Parent  d402acdf7c439dc369b6ab3a6888078a2895978a
dispatch: modernize the ui after finalizing config loading

We have to carefuly load the defaults layer in the ui object after we have read
configurations and set --config, as we are modifying configurations based on a
config settings. In our case we have to ensure that 'ui.compat=' can be set from
--config or any hgrc, but when we detect it have to add our setting as early as
possible. Therefore we choose dispatch to add it, right after we finalize
--config parsing.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -26,6 +26,7 @@ 
     cmdutil,
     color,
     commands,
+    compat,
     debugcommands,
     demandimport,
     encoding,
@@ -178,6 +179,7 @@ 
                 for sec, name, val in cfgs:
                     req.repo.ui.setconfig(sec, name, val, source='--config')
 
+            compat.modernize(ui)
             # developer config: ui.debugger
             debugger = ui.config("ui", "debugger")
             debugmod = pdb