Patchwork [3,of,3,evolve-ext] config: remove uses of obsolete._enabled

login
register
mail settings
Submitter Durham Goode
Date March 18, 2015, 2:17 a.m.
Message ID <9b38d0d9e859376aa538.1426645048@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8140/
State Accepted
Headers show

Comments

Durham Goode - March 18, 2015, 2:17 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1426644256 25200
#      Tue Mar 17 19:04:16 2015 -0700
# Branch stable
# Node ID 9b38d0d9e859376aa538186e0608f9cf6549f535
# Parent  43acc42c7a8d117c5e8a89a8aff08e44906f8d51
config: remove uses of obsolete._enabled

Upstream Mercurial will be removing obsolete._enabled soon, so switch all our
uses of it to use the new obsolete.isenabled(repo, option) function.
Pierre-Yves David - March 19, 2015, 6:25 p.m.
On 03/17/2015 07:17 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1426644256 25200
> #      Tue Mar 17 19:04:16 2015 -0700
> # Branch stable
> # Node ID 9b38d0d9e859376aa538186e0608f9cf6549f535
> # Parent  43acc42c7a8d117c5e8a89a8aff08e44906f8d51
> config: remove uses of obsolete._enabled

I've pushed patches 2 and 3. I dropped patch 1 as it did not striked me 
as necessary.

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2319,7 +2319,7 @@  def obsexcprg(ui, *args, **kwargs):
 if getattr(exchange, '_pushdiscoveryobsmarkers', None) is not None:
     @eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers')
     def _pushdiscoveryobsmarkers(orig, pushop):
-        if (obsolete._enabled
+        if (obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
             and pushop.repo.obsstore
             and 'obsolete' in pushop.remote.listkeys('namespaces')):
             repo = pushop.repo
@@ -2361,7 +2361,7 @@  if getattr(exchange, '_pushdiscoveryobsm
 def discocapabilities(orig, repo, proto):
     """wrapper to advertise new capability"""
     caps = orig(repo, proto)
-    if obsolete._enabled:
+    if obsolete.isenabled(repo, obsolete.exchangeopt):
         caps += ' _evoext_obshash_0'
     return caps
 
@@ -2496,7 +2496,7 @@  def _pushobsolete(orig, pushop):
     remote = pushop.remote
     unfi = repo.unfiltered()
     cl = unfi.changelog
-    if (obsolete._enabled and repo.obsstore and
+    if (obsolete.isenabled(repo, obsolete.exchangeopt) and repo.obsstore and
         'obsolete' in remote.listkeys('namespaces')):
         markers = pushop.outobsmarkers
         if not markers:
@@ -2660,7 +2660,7 @@  if getattr(exchange, '_getbundleobsmarke
 
 @eh.wrapfunction(exchange, '_pullobsolete')
 def _pullobsolete(orig, pullop):
-    if not obsolete._enabled:
+    if not obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
         return None
     if 'obsmarkers' not in getattr(pullop, 'todosteps', ['obsmarkers']):
         return None
@@ -2864,7 +2864,7 @@  def debugobsconvert(ui, repo, new_format
 def capabilities(orig, repo, proto):
     """wrapper to advertise new capability"""
     caps = orig(repo, proto)
-    if obsolete._enabled:
+    if obsolete.isenabled(repo, obsolete.exchangeopt):
         caps += ' _evoext_pushobsmarkers_0'
         caps += ' _evoext_pullobsmarkers_0'
         caps += ' _evoext_obshash_0'