changeset 18966:5572f688e0a9

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 09 Feb 2013 14:22:52 -0500
parents 0062508b1900
children 88d1b59f6906
files mercurial/ui.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py	Sat Feb 09 14:15:34 2013 -0500
+++ b/mercurial/ui.py	Sat Feb 09 14:22:52 2013 -0500
@@ -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'''