Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 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 | 8475c9bf096d |
children | 5f8f013e7d52 |
comparison
equal
deleted
inserted
replaced
37675:5b8a260769a2 | 37676:1764527af92e |
---|---|
397 # to allow general revsets (perhaps because "x" may come from a remote | 397 # to allow general revsets (perhaps because "x" may come from a remote |
398 # user and the revset may be too costly), use scmutil.revsymbol(repo, x) | 398 # user and the revset may be too costly), use scmutil.revsymbol(repo, x) |
399 # * If "x" can be a mix of the above, you'll have to figure it out | 399 # * If "x" can be a mix of the above, you'll have to figure it out |
400 # yourself | 400 # yourself |
401 repo.ui.deprecwarn("changectx.__init__ is getting more limited, see source " | 401 repo.ui.deprecwarn("changectx.__init__ is getting more limited, see source " |
402 "for details", "4.6") | 402 "for details", "4.6", stacklevel=4) |
403 | 403 |
404 class changectx(basectx): | 404 class changectx(basectx): |
405 """A changecontext object makes access to data related to a particular | 405 """A changecontext object makes access to data related to a particular |
406 changeset convenient. It represents a read-only context already present in | 406 changeset convenient. It represents a read-only context already present in |
407 the repo.""" | 407 the repo.""" |