[PATCH evolve-ext] evolve: do not set experimental.evolution in uisetup

Jun Wu quark at fb.com
Sun Apr 3 00:02:58 UTC 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1459641729 -3600
#      Sun Apr 03 01:02:09 2016 +0100
# Node ID eb063ecaef4c50fb50f6f21dd04b087cf1ac35b4
# Parent  45b2b59ce5d3a8641814107c7fc0808a361a8f30
evolve: do not set experimental.evolution in uisetup

Before this patch, evolve will set experimental.evolution=all if it's empty.
This does not work well with chg, since chg only runs uisetup once and will
copy configs modified by extensions when loading new ui unconditionally.

In this case, if the user starts a chgserver with empty experimental.evolution,
evolve will set it to "all" and the user will lose changes to set it to other
value.

This patch addressed the issue by replacing ui.setconfig with a default value
at reading time (ui.configlist).

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -390,15 +390,6 @@
 ### Option configuration                                          ###
 #####################################################################
 
- at eh.reposetup # must be the first of its kin.
-def _configureoptions(ui, repo):
-    # If no capabilities are specified, enable everything.
-    # This is so existing evolve users don't need to change their config.
-    evolveopts = ui.configlist('experimental', 'evolution')
-    if not evolveopts:
-        evolveopts = ['all']
-        ui.setconfig('experimental', 'evolution', evolveopts)
-
 @eh.uisetup
 def _configurecmdoptions(ui):
     # Unregister evolve commands if the command capability is not specified.
@@ -407,7 +398,7 @@
     # guarantee it happens after the above configuration, but before the
     # extsetup functions.
     evolvecommands = ui.configlist('experimental', 'evolutioncommands')
-    evolveopts = ui.configlist('experimental', 'evolution')
+    evolveopts = ui.configlist('experimental', 'evolution', ['all'])
     if evolveopts and (commandopt not in evolveopts and
                        'all' not in evolveopts):
         # We build whitelist containing the commands we want to enable


More information about the Mercurial-devel mailing list