Mercurial > hg > evolve
changeset 881:10867a8e27c6
exchange: properly wrap wireprotocol capabilities
Just wrapping the module function only works for ssh. Ssh gets capability
through the `hello` command. We also need to wrap the function stored in the
command dict. This fix discovery for http peer.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 10 Mar 2014 21:34:36 -0700 |
parents | 19a7ed6384a9 |
children | 8c9601a6c4e0 |
files | hgext/evolve.py hgext/simple4server.py |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -2455,4 +2455,9 @@ hgweb_mod.perms['evoext_obshash'] = 'pull' wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') + # wrap command content + oldcap, args = wireproto.commands['capabilities'] + def newcap(repo, proto): + return capabilities(oldcap, repo, proto) + wireproto.commands['capabilities'] = (newcap, args) wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')
--- a/hgext/simple4server.py +++ b/hgext/simple4server.py @@ -223,5 +223,11 @@ hgweb_mod.perms['evoext_obshash'] = 'pull' wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '') wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*') + # wrap module content extensions.wrapfunction(wireproto, 'capabilities', capabilities) + # wrap command content + oldcap, args = wireproto.commands['capabilities'] + def newcap(repo, proto): + return capabilities(oldcap, repo, proto) + wireproto.commands['capabilities'] = (newcap, args) wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')