extensions: copy attributes to wrapper by wrapfunction()
authorYuya Nishihara <yuya@tcha.org>
Sat, 09 Jan 2016 19:52:55 +0900
changeset 28311 1b0ef07ba783
parent 28310 01dc11e7191f
child 28312 24f1d3c70c41
extensions: copy attributes to wrapper by wrapfunction() Before this patch, new partial function "wrap" had no useful docstring. It makes sense to copy __doc__ and __module__ as we do for wrapcommand().
mercurial/extensions.py
--- a/mercurial/extensions.py	Sat Jan 09 19:45:10 2016 +0900
+++ b/mercurial/extensions.py	Sat Jan 09 19:52:55 2016 +0900
@@ -286,7 +286,9 @@
 
     origfn = getattr(container, funcname)
     assert callable(origfn)
-    setattr(container, funcname, bind(wrapper, origfn))
+    wrap = bind(wrapper, origfn)
+    _updatewrapper(wrap, origfn)
+    setattr(container, funcname, wrap)
     return origfn
 
 def _disabledpaths(strip_init=False):