changeset 37676:1764527af92e

context: set stack level for deprecation warning This patch makes the deprecation warning print the caller of repo.__getitem__. That's not quite correct, since there could also be other callers of changectx.__init__, but it seems like the most helpful stack level in practice. Differential Revision: https://phab.mercurial-scm.org/D3307
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 13 Apr 2018 09:19:38 -0700
parents 5b8a260769a2
children 41ac707322ba
files mercurial/context.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Apr 13 14:18:26 2018 -0700
+++ b/mercurial/context.py	Fri Apr 13 09:19:38 2018 -0700
@@ -399,7 +399,7 @@
     #  * If "x" can be a mix of the above, you'll have to figure it out
     #    yourself
     repo.ui.deprecwarn("changectx.__init__ is getting more limited, see source "
-                       "for details", "4.6")
+                       "for details", "4.6", stacklevel=4)
 
 class changectx(basectx):
     """A changecontext object makes access to data related to a particular