Mercurial > public > mercurial-scm > hg-stable
diff mercurial/ui.py @ 25629:52e5f68d8363
devel-warn: move the develwarn function as a method of the ui object
We are going to use this feature in more and more place. Having to import
scmutil makes it an import cycle hell.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 19 Jun 2015 11:19:45 -0700 |
parents | c1ff82daed62 |
children | 328739ea70c3 |
line wrap: on
line diff
--- a/mercurial/ui.py Thu Jun 18 23:08:27 2015 +0900 +++ b/mercurial/ui.py Fri Jun 19 11:19:45 2015 -0700 @@ -5,6 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +import inspect from i18n import _ import errno, getpass, os, socket, sys, tempfile, traceback import config, scmutil, util, error, formatter, progress @@ -958,6 +959,16 @@ ''' return msg + def develwarn(self, msg): + """issue a developer warning message""" + msg = 'devel-warn: ' + msg + if self.tracebackflag: + util.debugstacktrace(msg, 2) + else: + curframe = inspect.currentframe() + calframe = inspect.getouterframes(curframe, 2) + self.write_err('%s at: %s:%s (%s)\n' % ((msg,) + calframe[2][1:4])) + class paths(dict): """Represents a collection of paths and their configs.