# HG changeset patch # User Pierre-Yves David # Date 1394512476 25200 # Node ID 10867a8e27c63a806a9517197d5f59f1f03acd20 # Parent 19a7ed6384a9dfc8a45df2a00fe454ccb64e4798 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. diff -r 19a7ed6384a9 -r 10867a8e27c6 hgext/evolve.py --- a/hgext/evolve.py Mon Mar 10 17:40:38 2014 -0700 +++ b/hgext/evolve.py Mon Mar 10 21:34:36 2014 -0700 @@ -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') diff -r 19a7ed6384a9 -r 10867a8e27c6 hgext/simple4server.py --- a/hgext/simple4server.py Mon Mar 10 17:40:38 2014 -0700 +++ b/hgext/simple4server.py Mon Mar 10 21:34:36 2014 -0700 @@ -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')