D2018: largefiles: register wire protocol commands with modern APIs
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Sat Feb 3 01:50:49 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2018
AFFECTED FILES
hgext/largefiles/uisetup.py
CHANGE DETAILS
diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py
+++ b/hgext/largefiles/uisetup.py
@@ -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
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list