changeset 28311:1b0ef07ba783

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().
author Yuya Nishihara <yuya@tcha.org>
date Sat, 09 Jan 2016 19:52:55 +0900
parents 01dc11e7191f
children 24f1d3c70c41
files mercurial/extensions.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):