changeset 37675:5b8a260769a2

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
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 13 Apr 2018 14:18:26 -0700
parents f83cb91b052e
children 1764527af92e
files mercurial/util.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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