[PATCH 3 of 4 STABLE V3] ui: add 'force' parameter to traceback() to override the current print setting
Matt Harbison
matt_harbison at yahoo.com
Thu Feb 14 21:57:53 CST 2013
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1360437772 18000
# Branch stable
# Node ID 531876e328ce07dd3a93ea00e63b00afdfd0b806
# Parent 18b83d035077297b4da66bbd177743533870b061
ui: add 'force' parameter to traceback() to override the current print setting
This will allow a current traceback.print_exc() call in dispatch to be replaced
with ui.traceback() even if --traceback was not given on the command line.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -681,11 +681,11 @@
return t
- def traceback(self, exc=None):
- '''print exception traceback if traceback printing enabled.
+ def traceback(self, exc=None, force=False):
+ '''print exception traceback if traceback printing enabled or forced.
only to call in exception handler. returns true if traceback
printed.'''
- if self.tracebackflag:
+ if self.tracebackflag or force:
if exc is None:
exc = sys.exc_info()
cause = getattr(exc[1], 'cause', None)
@@ -703,7 +703,7 @@
else:
traceback.print_exception(exc[0], exc[1], exc[2],
file=self.ferr)
- return self.tracebackflag
+ return self.tracebackflag or force
def geteditor(self):
'''return editor to use'''
More information about the Mercurial-devel
mailing list