util: set correct stack level on deprecation warnings
Without this patch, you'll get something like this:
<path>/mercurial/util.py:3784: DeprecationWarning: 'util.hgexecutable'
is deprecated, use 'utils.procutil.hgexecutable'
(but on one line)
Differential Revision: https://phab.mercurial-scm.org/D3331
--- a/mercurial/util.py Sat Apr 14 12:57:32 2018 +0900
+++ b/mercurial/util.py Fri Apr 13 14:18:26 2018 -0700
@@ -3781,7 +3781,7 @@
fn = pycompat.sysbytes(func.__name__)
mn = modname or pycompat.sysbytes(func.__module__)[len('mercurial.'):]
msg = "'util.%s' is deprecated, use '%s.%s'" % (fn, mn, fn)
- nouideprecwarn(msg, version)
+ nouideprecwarn(msg, version, stacklevel=2)
return func(*args, **kwargs)
wrapped.__name__ = func.__name__
return wrapped