server4simple: remove use of obsolete._enabled
authorDurham Goode <durham@fb.com>
Thu, 19 Mar 2015 13:41:58 -0700
changeset 1215 004e21b8d67b
parent 1214 4b10e2c6f7e3
child 1216 a307eea46f96
server4simple: remove use of obsolete._enabled obsolete._enabled is deprecated, so let's replace it's uses.
hgext/simple4server.py
--- a/hgext/simple4server.py	Tue Mar 17 19:04:16 2015 -0700
+++ b/hgext/simple4server.py	Thu Mar 19 13:41:58 2015 -0700
@@ -12,7 +12,6 @@
 buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
 
 import mercurial.obsolete
-mercurial.obsolete._enabled = True
 
 import struct
 from mercurial import util
@@ -30,8 +29,6 @@
 gboptslist = gboptsmap = None
 try:
     from mercurial import obsolete
-    if not obsolete._enabled:
-        obsolete._enabled = True
     from mercurial import wireproto
     gboptslist = getattr(wireproto, 'gboptslist', None)
     gboptsmap = getattr(wireproto, 'gboptsmap', None)
@@ -233,7 +230,7 @@
     """wrapper to advertise new capability"""
     caps = orig(repo, proto)
     advertise = repo.ui.configbool('__temporary__', 'advertiseobsolete', True)
-    if obsolete._enabled and advertise:
+    if obsolete.isenabled(repo, obsolete.exchangeopt) and advertise:
         caps += ' _evoext_pushobsmarkers_0'
         caps += ' _evoext_pullobsmarkers_0'
         caps += ' _evoext_obshash_0'
@@ -280,3 +277,8 @@
     extensions.wrapfunction(pushkey, '_nslist', _nslist)
     pushkey._namespaces['namespaces'] = (lambda *x: False, pushkey._nslist)
 
+def reposetup(ui, repo):
+    evolveopts = ui.configlist('experimental', 'evolution')
+    if not evolveopts:
+        evolveopts = 'all'
+        ui.setconfig('experimental', 'evolution', evolveopts)