[PATCH 6 of 6 RFC] dispatch: modernize the ui after finalizing config loading

David Soria Parra davidsp at fb.com
Sun Mar 12 16:10:46 EDT 2017


# HG changeset patch
# User David Soria Parra <davidsp at fb.com>
# Date 1489349206 25200
#      Sun Mar 12 13:06:46 2017 -0700
# Node ID 9eca95dec659b3ff37608fd257d888520599124d
# Parent  2dfa752cf0751010867944aa707bd7a722d3ea87
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.

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


More information about the Mercurial-devel mailing list