largefiles: register wire protocol commands with modern APIs
The wireproto.wireprotocommand decorator is the preferred mechanism for
registering wire protocol commands. In addition, wireproto.commands
is no longer a 2-tuple and use of that 2-tuple API should be considered
deprecated.
This commit ports largefiles to use wireproto.wireprotocommand()
and ports to the "commandentry" API.
As part of this, the definition of the "lheads" wire protocol
command is moved to the proper stanza.
We stop short of actually using wireprotocommand as a decorator
in order to minimize churn. We should ideally move wire protocol
commands to the registrar mechanism. But that's for another
changeset.
Differential Revision: https://phab.mercurial-scm.org/D2018
--- a/hgext/largefiles/uisetup.py Tue Jan 30 18:41:44 2018 -0800
+++ b/hgext/largefiles/uisetup.py Thu Feb 01 18:48:52 2018 -0800
@@ -165,13 +165,13 @@
overrides.openlargefile)
# create the new wireproto commands ...
- wireproto.commands['putlfile'] = (proto.putlfile, 'sha')
- wireproto.commands['getlfile'] = (proto.getlfile, 'sha')
- wireproto.commands['statlfile'] = (proto.statlfile, 'sha')
+ wireproto.wireprotocommand('putlfile', 'sha')(proto.putlfile)
+ wireproto.wireprotocommand('getlfile', 'sha')(proto.getlfile)
+ wireproto.wireprotocommand('statlfile', 'sha')(proto.statlfile)
+ wireproto.wireprotocommand('lheads', '')(wireproto.heads)
# ... and wrap some existing ones
- wireproto.commands['heads'] = (proto.heads, '')
- wireproto.commands['lheads'] = (wireproto.heads, '')
+ wireproto.commands['heads'].func = proto.heads
# make putlfile behave the same as push and {get,stat}lfile behave
# the same as pull w.r.t. permissions checks