# HG changeset patch # User mpm@selenic.com # Date 1120083654 28800 # Node ID 58790c83ce52b9dc624d980584e7c75d429ac514 # Parent 55af04e26bad1d8a323a8f4c5d23b38106501094 [PATCH] Add --traceback option -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Add --traceback option From: Bryan O'Sullivan Add --traceback option, to force printing tracebacks on top-level exceptions. manifest hash: 4347f42205b8b23835424b4e4100860ff2834b95 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwx7GywK+sNU5EO8RAgS8AKCmJAvTMGNJYYIW9eTI3RAqJZMfYACfS/rl Hn1Ukml5D1fdSvyehH2G080= =eLJO -----END PGP SIGNATURE----- diff -r 55af04e26bad -r 58790c83ce52 mercurial/commands.py --- a/mercurial/commands.py Wed Jun 29 14:15:16 2005 -0800 +++ b/mercurial/commands.py Wed Jun 29 14:20:54 2005 -0800 @@ -818,6 +818,7 @@ ('q', 'quiet', None, 'quiet'), ('p', 'profile', None, 'profile'), ('R', 'repository', "", 'repository root directory'), + ('', 'traceback', None, 'print traceback on exception'), ('y', 'noninteractive', None, 'run non-interactively'), ('', 'version', None, 'output version information and exit'), ] @@ -855,25 +856,30 @@ sys.exit(-1) try: - if cmd not in norepo.split(): - path = options["repository"] or "" - repo = hg.repository(ui=u, path=path) - d = lambda: i[0](u, repo, *args, **cmdoptions) - else: - d = lambda: i[0](u, *args, **cmdoptions) + try: + if cmd not in norepo.split(): + path = options["repository"] or "" + repo = hg.repository(ui=u, path=path) + d = lambda: i[0](u, repo, *args, **cmdoptions) + else: + d = lambda: i[0](u, *args, **cmdoptions) - if options['profile']: - import hotshot, hotshot.stats - prof = hotshot.Profile("hg.prof") - r = prof.runcall(d) - prof.close() - stats = hotshot.stats.load("hg.prof") - stats.strip_dirs() - stats.sort_stats('time', 'calls') - stats.print_stats(40) - return r - else: - return d() + if options['profile']: + import hotshot, hotshot.stats + prof = hotshot.Profile("hg.prof") + r = prof.runcall(d) + prof.close() + stats = hotshot.stats.load("hg.prof") + stats.strip_dirs() + stats.sort_stats('time', 'calls') + stats.print_stats(40) + return r + else: + return d() + except: + if options['traceback']: + traceback.print_exc() + raise except util.CommandError, inst: u.warn("abort: %s\n" % inst.args) except hg.RepoError, inst: