Patchwork [3,of,4,evolve-ext] pushexperiment: remove use of obsolete._enabled

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

Comments

Durham Goode - March 20, 2015, 12:46 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1426812141 25200
#      Thu Mar 19 17:42:21 2015 -0700
# Node ID a7288e85066cbc608b12ac6015ea9de4a3b51fec
# Parent  af2f360a45bf54d132033d5891f207d23cdcc72b
pushexperiment: remove use of obsolete._enabled

pushexperiment.py was using obsolete._enabled but it didn't cause any tests to
fail so I didn't see it.  Let's go ahead and replace it with the new
obsolete.isenabled() api.
Pierre-Yves David - March 20, 2015, 6:18 p.m.
On 03/19/2015 05:46 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1426812141 25200
> #      Thu Mar 19 17:42:21 2015 -0700
> # Node ID a7288e85066cbc608b12ac6015ea9de4a3b51fec
> # Parent  af2f360a45bf54d132033d5891f207d23cdcc72b
> pushexperiment: remove use of obsolete._enabled

these first 3 are pushed.

patch 4 seems good, but I need some time to think about it.

Patch

diff --git a/hgext/pushexperiment.py b/hgext/pushexperiment.py
--- a/hgext/pushexperiment.py
+++ b/hgext/pushexperiment.py
@@ -49,7 +49,8 @@  def srv_pushobsmarkers(repo, proto):
 
 def syncpush(orig, repo, remote):
     """wraper for obsolete.syncpush to use the fast way if possible"""
-    if not (obsolete._enabled and repo.obsstore):
+    if not (obsolete.isenabled(repo, obsolete.createmarkersopt) and
+            repo.obsstore):
         return
     if remote.capable('_push_experiment_pushobsmarkers_0'):
         return # already pushed before changeset
@@ -75,7 +76,7 @@  def augmented_push(orig, repo, remote, *
     """push wrapped that call the wire protocol command"""
     if not remote.canpush():
         raise util.Abort(_("destination does not support push"))
-    if (obsolete._enabled and repo.obsstore
+    if (obsolete.isenabled(repo, obsolete.exchangeopt) and repo.obsstore
         and remote.capable('_push_experiment_pushobsmarkers_0')):
         # push marker early to limit damage of pushing too early.
         try:
@@ -94,7 +95,7 @@  def augmented_push(orig, repo, remote, *
 def capabilities(orig, repo, proto):
     """wrapper to advertise new capability"""
     caps = orig(repo, proto)
-    if obsolete._enabled:
+    if obsolete.isenabled(repo, obsolete.exchangeopt):
         caps += ' _push_experiment_pushobsmarkers_0'
     caps += ' _push_experiment_notifypushend_0'
     return caps