wrapcommand: use functools.partial
authorJun Wu <quark@fb.com>
Tue, 05 Sep 2017 15:18:45 -0700
changeset 34105 a763c891f36e
parent 34104 5361771f9714
child 34106 bbdca7e460c0
wrapcommand: use functools.partial Like the previous patch, this helps remove noises in traceback. Practically, this removes another 6 lines in `rebase -s . -d .` traceback in my setup: .... File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) -File "hg/mercurial/extensions.py", line 331, in closure - return func(*(args + a), **kw) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) File "fb-hgext/hgext3rd/fbhistedit.py", line 283, in _rebase return orig(ui, repo, **opts) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) -File "hg/mercurial/extensions.py", line 331, in closure - return func(*(args + a), **kw) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) File "remotenames.py", line 633, in exrebasecmd ret = orig(ui, repo, **opts) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) -File "hg/mercurial/extensions.py", line 331, in closure - return func(*(args + a), **kw) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) File "fb-hgext/hgext3rd/fbamend/__init__.py", line 453, in wraprebase return orig(ui, repo, **opts) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) .... Differential Revision: https://phab.mercurial-scm.org/D633
mercurial/extensions.py
--- a/mercurial/extensions.py	Tue Sep 05 13:37:36 2017 -0700
+++ b/mercurial/extensions.py	Tue Sep 05 15:18:45 2017 -0700
@@ -377,7 +377,8 @@
             break
 
     origfn = entry[0]
-    wrap = bind(util.checksignature(wrapper), util.checksignature(origfn))
+    wrap = functools.partial(util.checksignature(wrapper),
+                             util.checksignature(origfn))
     _updatewrapper(wrap, origfn, wrapper)
     if docstring is not None:
         wrap.__doc__ += docstring