# HG changeset patch # User Yuya Nishihara # Date 2016-01-09 11:04:03 # Node ID 24f1d3c70c41429f01d1f3276df8fef664187cd9 # Parent 1b0ef07ba783eda35e7796607c5395cf85bf24a4 extensions: copy extra __dict__ of original function Future patches will make @command decorator set properties such as "norepo" to a function object. This patch makes sure these properties never be lost by wrapcommand() or wrapfunction(). This change won't be crazy as the standard functools.wraps() copies __dict__. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -199,6 +199,7 @@ def _updatewrapper(wrap, origfn): '''Copy attributes to wrapper function''' wrap.__module__ = getattr(origfn, '__module__') wrap.__doc__ = getattr(origfn, '__doc__') + wrap.__dict__.update(getattr(origfn, '__dict__', {})) def wrapcommand(table, command, wrapper, synopsis=None, docstring=None): '''Wrap the command named `command' in table