[PATCH 07 of 10] ui: allow develwarn without a stack
Jun Wu
quark at fb.com
Thu Jun 30 12:59:02 EDT 2016
# HG changeset patch
# User Jun Wu <quark at fb.com>
# 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)
More information about the Mercurial-devel
mailing list