Mercurial > hg
changeset 2166:d0c02b4dce9a
do not check sys.argv from localrepo when running hooks.
instead add traceback field to ui class.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Sun, 30 Apr 2006 16:30:39 -0700 |
parents | cbd458228a96 |
children | f5c2c6e69fd7 |
files | mercurial/commands.py mercurial/localrepo.py mercurial/ui.py |
diffstat | 3 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/commands.py Sun Apr 30 16:30:39 2006 -0700 @@ -3365,7 +3365,7 @@ if num: signal.signal(num, catchterm) try: - u = ui.ui() + u = ui.ui(traceback='--traceback' in sys.argv[1:]) except util.Abort, inst: sys.stderr.write(_("abort: %s\n") % inst) return -1 @@ -3389,7 +3389,7 @@ external.append(mod) except Exception, inst: u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) - if "--traceback" in sys.argv[1:]: + if u.traceback: traceback.print_exc() return 1 continue @@ -3417,7 +3417,7 @@ atexit.register(print_time) u.updateopts(options["verbose"], options["debug"], options["quiet"], - not options["noninteractive"]) + not options["noninteractive"], options["traceback"]) # enter the debugger before command execution if options['debugger']: @@ -3484,7 +3484,7 @@ # enter the debugger when we hit an exception if options['debugger']: pdb.post_mortem(sys.exc_info()[2]) - if options['traceback']: + if u.traceback: traceback.print_exc() raise except ParseError, inst:
--- a/mercurial/localrepo.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/localrepo.py Sun Apr 30 16:30:39 2006 -0700 @@ -12,7 +12,7 @@ from demandload import * demandload(globals(), "appendfile changegroup") demandload(globals(), "re lock transaction tempfile stat mdiff errno ui") -demandload(globals(), "revlog sys traceback") +demandload(globals(), "revlog traceback") class localrepository(object): def __del__(self): @@ -117,7 +117,7 @@ '%s\n') % (hname, exc)) if throw: raise - if "--traceback" in sys.argv[1:]: + if self.ui.traceback: traceback.print_exc() return False if not r:
--- a/mercurial/ui.py Sun Apr 30 19:30:59 2006 +0200 +++ b/mercurial/ui.py Sun Apr 30 16:30:39 2006 -0700 @@ -12,7 +12,7 @@ class ui(object): def __init__(self, verbose=False, debug=False, quiet=False, - interactive=True, parentui=None): + interactive=True, traceback=False, parentui=None): self.overlay = {} if parentui is None: # this is the parent of all ui children @@ -24,6 +24,7 @@ self.verbose = self.configbool("ui", "verbose") self.debugflag = self.configbool("ui", "debug") self.interactive = self.configbool("ui", "interactive", True) + self.traceback = traceback self.updateopts(verbose, debug, quiet, interactive) self.diffcache = None @@ -45,11 +46,12 @@ return getattr(self.parentui, key) def updateopts(self, verbose=False, debug=False, quiet=False, - interactive=True): + interactive=True, traceback=False): self.quiet = (self.quiet or quiet) and not verbose and not debug self.verbose = (self.verbose or verbose) or debug self.debugflag = (self.debugflag or debug) self.interactive = (self.interactive and interactive) + self.traceback = self.traceback or traceback def readconfig(self, fn, root=None): if isinstance(fn, basestring):