changeset 36022:f540b6448738

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 01 Feb 2018 18:48:52 -0800
parents 5a56bf4180ad
children cdc93fe1da77
files hgext/largefiles/uisetup.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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