comparison hgext/pushexperiment.py @ 1217:196c650d5ba9

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.
author Durham Goode <durham@fb.com>
date Thu, 19 Mar 2015 17:42:21 -0700
parents 05ec92d8150d
children 777e5c369d99
comparison
equal deleted inserted replaced
1216:a307eea46f96 1217:196c650d5ba9
47 return wireproto.pushres(0) 47 return wireproto.pushres(0)
48 48
49 49
50 def syncpush(orig, repo, remote): 50 def syncpush(orig, repo, remote):
51 """wraper for obsolete.syncpush to use the fast way if possible""" 51 """wraper for obsolete.syncpush to use the fast way if possible"""
52 if not (obsolete._enabled and repo.obsstore): 52 if not (obsolete.isenabled(repo, obsolete.exchangeopt) and
53 repo.obsstore):
53 return 54 return
54 if remote.capable('_push_experiment_pushobsmarkers_0'): 55 if remote.capable('_push_experiment_pushobsmarkers_0'):
55 return # already pushed before changeset 56 return # already pushed before changeset
56 remote.push_experiment_pushobsmarkers_0(obsfp) 57 remote.push_experiment_pushobsmarkers_0(obsfp)
57 return 58 return
73 74
74 def augmented_push(orig, repo, remote, *args, **kwargs): 75 def augmented_push(orig, repo, remote, *args, **kwargs):
75 """push wrapped that call the wire protocol command""" 76 """push wrapped that call the wire protocol command"""
76 if not remote.canpush(): 77 if not remote.canpush():
77 raise util.Abort(_("destination does not support push")) 78 raise util.Abort(_("destination does not support push"))
78 if (obsolete._enabled and repo.obsstore 79 if (obsolete.isenabled(repo, obsolete.exchangeopt) and repo.obsstore
79 and remote.capable('_push_experiment_pushobsmarkers_0')): 80 and remote.capable('_push_experiment_pushobsmarkers_0')):
80 # push marker early to limit damage of pushing too early. 81 # push marker early to limit damage of pushing too early.
81 try: 82 try:
82 obsfp = repo.sopener('obsstore') 83 obsfp = repo.sopener('obsstore')
83 except IOError as e: 84 except IOError as e:
92 93
93 94
94 def capabilities(orig, repo, proto): 95 def capabilities(orig, repo, proto):
95 """wrapper to advertise new capability""" 96 """wrapper to advertise new capability"""
96 caps = orig(repo, proto) 97 caps = orig(repo, proto)
97 if obsolete._enabled: 98 if obsolete.isenabled(repo, obsolete.exchangeopt):
98 caps += ' _push_experiment_pushobsmarkers_0' 99 caps += ' _push_experiment_pushobsmarkers_0'
99 caps += ' _push_experiment_notifypushend_0' 100 caps += ' _push_experiment_notifypushend_0'
100 return caps 101 return caps
101 102
102 103