Mercurial > hg
diff hgext/phabricator.py @ 44436:09f3e003fc2a
phabricator: avoid a stacktrace when command arguments are missing
Previously, the TypeError wasn't properly converted to a SignatureError when
improper arguments were supplied to the inner function, because the stack depth
is 2 inside the vcrcommand decorator. The `__name__` and `__doc__` attributes
need to be reassigned to the new wrapper so that the help summary is available.
Differential Revision: https://phab.mercurial-scm.org/D8209
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 04 Mar 2020 00:45:54 -0500 |
parents | 4ce2330f2d0b |
children | 9d2b2df2c2ba |
line wrap: on
line diff
--- a/hgext/phabricator.py Fri Jan 24 15:51:19 2020 -0800 +++ b/hgext/phabricator.py Wed Mar 04 00:45:54 2020 -0500 @@ -257,15 +257,17 @@ return fn(*args, **kwargs) return fn(*args, **kwargs) - inner.__name__ = fn.__name__ - inner.__doc__ = fn.__doc__ + cmd = util.checksignature(inner, depth=2) + cmd.__name__ = fn.__name__ + cmd.__doc__ = fn.__doc__ + return command( name, fullflags, spec, helpcategory=helpcategory, optionalrepo=optionalrepo, - )(inner) + )(cmd) return decorate