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

David Soria Parra davidsp at fb.com
Sun Mar 12 18:40:29 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 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.

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