Patchwork [1,of,4,evolve-ext] server4simple: remove use of obsolete._enabled

login
register
mail settings
Submitter Durham Goode
Date March 20, 2015, 12:46 a.m.
Message ID <ebd12d85d718759a344c.1426812416@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8184/
State Accepted
Headers show

Comments

Durham Goode - March 20, 2015, 12:46 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1426797718 25200
#      Thu Mar 19 13:41:58 2015 -0700
# Node ID ebd12d85d718759a344c74e234e10080bccdc2dd
# Parent  4b10e2c6f7e35590eb17525c53f2c0cfe2e9cd4b
server4simple: remove use of obsolete._enabled

obsolete._enabled is deprecated, so let's replace it's uses.

Patch

diff --git a/hgext/simple4server.py b/hgext/simple4server.py
--- a/hgext/simple4server.py
+++ b/hgext/simple4server.py
@@ -12,7 +12,6 @@  testedwith = '3.0.1'
 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 @@  from mercurial import exchange
 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 @@  def capabilities(orig, repo, proto):
     """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 @@  def extsetup(ui):
     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)