diff hgext/lfs/wireprotolfsserver.py @ 41048:84d61fdcefa5

lfs: convert to using exthelper to wrap functions I'm not 100% sure that upgraderequirements() can be double annotated safely, but it seems OK based on printing the address of the function being wrapped. One thing I've noticed is that @eh.reposetup doesn't do the usual check to ensure that it's a local repo. Should that be baked into @eh.reposetup() somehow, possibly with a non-default option to skip the check? It seems like a gaping hole if every function that gets registered needs to add this check.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 27 Nov 2018 22:10:07 -0500
parents a913d2892e17
children 7a11e4e55d5f
line wrap: on
line diff
--- a/hgext/lfs/wireprotolfsserver.py	Fri Nov 30 21:39:55 2018 -0500
+++ b/hgext/lfs/wireprotolfsserver.py	Tue Nov 27 22:10:07 2018 -0500
@@ -17,8 +17,10 @@
 )
 
 from mercurial import (
+    exthelper,
     pycompat,
     util,
+    wireprotoserver,
 )
 
 from . import blobstore
@@ -31,6 +33,9 @@
 HTTP_NOT_ACCEPTABLE = hgwebcommon.HTTP_NOT_ACCEPTABLE
 HTTP_UNSUPPORTED_MEDIA_TYPE = hgwebcommon.HTTP_UNSUPPORTED_MEDIA_TYPE
 
+eh = exthelper.exthelper()
+
+@eh.wrapfunction(wireprotoserver, 'handlewsgirequest')
 def handlewsgirequest(orig, rctx, req, res, checkperm):
     """Wrap wireprotoserver.handlewsgirequest() to possibly process an LFS
     request if it is left unprocessed by the wrapped method.