comparison hgext/evolve.py @ 1075:1205f42ae54c

discovery: use a different setup step for discovery This will ease the dropping of the other part later.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 Aug 2014 12:05:49 +0200
parents 442ab25f4747
children 2039385d6460
comparison
equal deleted inserted replaced
1074:442ab25f4747 1075:1205f42ae54c
2225 if ui.configbool('experimental', 'verbose-obsolescence-exchange', False): 2225 if ui.configbool('experimental', 'verbose-obsolescence-exchange', False):
2226 topic = 'OBSEXC' 2226 topic = 'OBSEXC'
2227 ui.progress(topic, *args, **kwargs) 2227 ui.progress(topic, *args, **kwargs)
2228 2228
2229 2229
2230 2230 @eh.wrapfunction(wireproto, 'capabilities')
2231 def discocapabilities(orig, repo, proto):
2232 """wrapper to advertise new capability"""
2233 caps = orig(repo, proto)
2234 if obsolete._enabled:
2235 caps += ' _evoext_obshash_0'
2236 return caps
2237
2238 @eh.extsetup
2239 def _installobsmarkersdiscovery(ui):
2240 hgweb_mod.perms['evoext_obshash'] = 'pull'
2241 # wrap command content
2242 oldcap, args = wireproto.commands['capabilities']
2243 def newcap(repo, proto):
2244 return discocapabilities(oldcap, repo, proto)
2245 wireproto.commands['capabilities'] = (newcap, args)
2246 wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')
2231 2247
2232 ### Set discovery START 2248 ### Set discovery START
2233 2249
2234 from mercurial import dagutil 2250 from mercurial import dagutil
2235 from mercurial import setdiscovery 2251 from mercurial import setdiscovery
2764 def _installwireprotocol(ui): 2780 def _installwireprotocol(ui):
2765 localrepo.moderncaps.add('_evoext_pullobsmarkers_0') 2781 localrepo.moderncaps.add('_evoext_pullobsmarkers_0')
2766 localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0') 2782 localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0')
2767 hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push' 2783 hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push'
2768 hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull' 2784 hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull'
2769 hgweb_mod.perms['evoext_obshash'] = 'pull'
2770 wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') 2785 wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')
2771 wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') 2786 wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*')
2772 # wrap command content 2787 # wrap command content
2773 oldcap, args = wireproto.commands['capabilities'] 2788 oldcap, args = wireproto.commands['capabilities']
2774 def newcap(repo, proto): 2789 def newcap(repo, proto):
2775 return capabilities(oldcap, repo, proto) 2790 return capabilities(oldcap, repo, proto)
2776 wireproto.commands['capabilities'] = (newcap, args) 2791 wireproto.commands['capabilities'] = (newcap, args)
2777 wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')