From patchwork Thu Jun 30 16:59:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [07,of,10] ui: allow develwarn without a stack From: Jun Wu X-Patchwork-Id: 15666 Message-Id: <6b6fdfbf77d35a290519.1467305942@x1c> To: Date: Thu, 30 Jun 2016 17:59:02 +0100 # HG changeset patch # User Jun Wu # Date 1467284364 -3600 # Thu Jun 30 11:59:24 2016 +0100 # Node ID 6b6fdfbf77d35a290519b6620b5fd999e10ac723 # Parent ae943c113c1b9f68313f0dfd7304e07dad53be75 # Available At https://bitbucket.org/quark-zju/hg-draft # hg pull https://bitbucket.org/quark-zju/hg-draft -r 6b6fdfbf77d3 ui: allow develwarn without a stack Sometimes we can only do aftermath check and do not have clues about the exact problematic location. This patch allows develwarn to be without a stack by setting stacklevel to None. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1157,12 +1157,15 @@ class ui(object): """issue a developer warning message Use 'stacklevel' to report the offender some layers further up in the - stack. + stack. If 'stacklevel' is None, no stack will be printed. """ if not self.configbool('devel', 'all-warnings'): if config is not None and not self.configbool('devel', config): return msg = 'devel-warn: ' + msg + if stacklevel is None: + self.log('develwarn', msg) + return stacklevel += 1 # get in develwarn if self.tracebackflag: util.debugstacktrace(msg, stacklevel, self.ferr, self.fout)