comparison 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
comparison
equal deleted inserted replaced
25628:9c647f427aef 25629:52e5f68d8363
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> 3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import inspect
8 from i18n import _ 9 from i18n import _
9 import errno, getpass, os, socket, sys, tempfile, traceback 10 import errno, getpass, os, socket, sys, tempfile, traceback
10 import config, scmutil, util, error, formatter, progress 11 import config, scmutil, util, error, formatter, progress
11 from node import hex 12 from node import hex
12 13
956 ui.write(s, 'label') is equivalent to 957 ui.write(s, 'label') is equivalent to
957 ui.write(ui.label(s, 'label')). 958 ui.write(ui.label(s, 'label')).
958 ''' 959 '''
959 return msg 960 return msg
960 961
962 def develwarn(self, msg):
963 """issue a developer warning message"""
964 msg = 'devel-warn: ' + msg
965 if self.tracebackflag:
966 util.debugstacktrace(msg, 2)
967 else:
968 curframe = inspect.currentframe()
969 calframe = inspect.getouterframes(curframe, 2)
970 self.write_err('%s at: %s:%s (%s)\n' % ((msg,) + calframe[2][1:4]))
971
961 class paths(dict): 972 class paths(dict):
962 """Represents a collection of paths and their configs. 973 """Represents a collection of paths and their configs.
963 974
964 Data is initially derived from ui instances and the config files they have 975 Data is initially derived from ui instances and the config files they have
965 loaded. 976 loaded.